X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=resources%2Fsrc%2Fjquery%2Fjquery.makeCollapsible.js;h=de307a69d98043f654e4a57ac3bd7c0f8c8833c5;hp=20bd405038e6f145fbe867c864601fd11aee25d9;hb=9e8439e79d67788916d488f645108f79016d9aca;hpb=3e74b6eeaaf4ad0ce1217d013cca09a3f07cb5c7 diff --git a/resources/src/jquery/jquery.makeCollapsible.js b/resources/src/jquery/jquery.makeCollapsible.js index 20bd405038..de307a69d9 100644 --- a/resources/src/jquery/jquery.makeCollapsible.js +++ b/resources/src/jquery/jquery.makeCollapsible.js @@ -136,6 +136,11 @@ .toggleClass( 'mw-collapsible-toggle-expanded', wasCollapsed ); } + // Toggle `aria-expanded` attribute, if requested (for default and premade togglers by default). + if ( options.toggleARIA ) { + $toggle.attr( 'aria-expanded', wasCollapsed ? 'true' : 'false' ); + } + // Toggle the text ("Show"/"Hide") within elements tagged with mw-collapsible-text if ( options.toggleText ) { collapseText = options.toggleText.collapseText; @@ -211,6 +216,7 @@ actionHandler = function ( e, opts ) { var defaultOpts = { toggleClasses: true, + toggleARIA: true, toggleText: { collapseText: collapseText, expandText: expandText } }; opts = $.extend( defaultOpts, options, opts ); @@ -324,6 +330,7 @@ // Attach event handlers to togglelink $toggle.on( 'click.mw-collapsible keypress.mw-collapsible', actionHandler ) + .attr( 'aria-expanded', 'true' ) .prop( 'tabIndex', 0 ); $( this ).data( 'mw-collapsible', {