X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=skins%2Fvector%2Fvector.js;h=aa64624ac01dad78fa04909b9bd220ef5e0cdda2;hb=d5740e4bfc4c20f3e7a770cdc71a2f3ee0cd5f51;hp=ff3332f8d808ea272982f45b206a81e32c99dcd4;hpb=d98e367d458188241cc79bdbe588344694e3c3d3;p=lhc%2Fweb%2Fwiklou.git diff --git a/skins/vector/vector.js b/skins/vector/vector.js index ff3332f8d8..aa64624ac0 100644 --- a/skins/vector/vector.js +++ b/skins/vector/vector.js @@ -4,19 +4,25 @@ jQuery( function ( $ ) { $( 'div.vectorMenu' ).each( function () { var $el = $( this ); - $el.find( 'h3:first a:first' ) - // For accessibility, show the menu when the hidden link in the menu is clicked (bug 24298) - .click( function ( e ) { - $el.find( '.menu:first' ).toggleClass( 'menuForceShow' ); - e.preventDefault(); + $el.find( '> h3 > a' ).parent() + .attr( 'tabindex', '0' ) + // For accessibility, show the menu when the h3 is clicked (bug 24298/46486) + .on( 'click keypress', function ( e ) { + if( e.type === 'click' || e.which === 13 ) { + $el.find( '.menu:first' ).toggleClass( 'menuForceShow' ); + e.preventDefault(); + } } ) - // When the hidden link has focus, also set a class that will change the arrow icon + // When the heading has focus, also set a class that will change the arrow icon .focus( function () { - $el.addClass( 'vectorMenuFocus' ); + $el.find( '> a' ).addClass( 'vectorMenuFocus' ); } ) .blur( function () { - $el.removeClass( 'vectorMenuFocus' ); - } ); + $el.find( '> a' ).removeClass( 'vectorMenuFocus' ); + } ) + .find( '> a:first' ) + // As the h3 can already be focused there's no need for the link to be focusable + .attr( 'tabindex', '-1' ); } ); /**