TheDJ has submitted this change and it was merged.
Change subject: Make variant selection menu toggleable by keyboard
..
Make variant selection menu toggleable by keyboard
Altered the script as the variant selection menu
uses a slightly different dom structure than the
other menus.
Bug: 46486
Change-Id: I4fdfe1cf002e4f5370b7073b509e33828db7dcbf
---
M skins/vector/vector.js
1 file changed, 15 insertions(+), 9 deletions(-)
Approvals:
Aude: Looks good to me, but someone else must approve
TheDJ: Looks good to me, approved
jenkins-bot: Verified
diff --git a/skins/vector/vector.js b/skins/vector/vector.js
index ff3332f..aa64624 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' );
} );
/**
--
To view, visit https://gerrit.wikimedia.org/r/79847
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4fdfe1cf002e4f5370b7073b509e33828db7dcbf
Gerrit-PatchSet: 8
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Hoo man h...@online.de
Gerrit-Reviewer: Aude aude.w...@gmail.com
Gerrit-Reviewer: Daniel Friesen dan...@nadir-seen-fire.com
Gerrit-Reviewer: Daniel Kinzler daniel.kinz...@wikimedia.de
Gerrit-Reviewer: Daniel Werner daniel.wer...@wikimedia.de
Gerrit-Reviewer: Hoo man h...@online.de
Gerrit-Reviewer: Jack Phoenix j...@countervandalism.net
Gerrit-Reviewer: Krinkle krinklem...@gmail.com
Gerrit-Reviewer: Liangent liang...@gmail.com
Gerrit-Reviewer: Matmarex matma@gmail.com
Gerrit-Reviewer: TheDJ hartman.w...@gmail.com
Gerrit-Reviewer: Waldir wal...@email.com
Gerrit-Reviewer: jenkins-bot
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits