Divadsn has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/395999 )
Change subject: Add tabindex to Special:Upload in mw-editTools
......................................................................
Add tabindex to Special:Upload in mw-editTools
Bug: T25238
Change-Id: I2b581667aaf0f95c9c0f189f5bf5e852c12fd3cd
---
M resources/src/mediawiki.special/mediawiki.special.upload.js
1 file changed, 36 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/99/395999/1
diff --git a/resources/src/mediawiki.special/mediawiki.special.upload.js
b/resources/src/mediawiki.special/mediawiki.special.upload.js
index 0ddf7fe..f487976 100644
--- a/resources/src/mediawiki.special/mediawiki.special.upload.js
+++ b/resources/src/mediawiki.special/mediawiki.special.upload.js
@@ -612,4 +612,40 @@
allowCloseWindow.release();
} );
} );
+
+ // Add tabindex to mw-editTools
+ $( function () {
+ // Function to change tabindex for all links within mw-editTools
+ function setEditTabindex( $val ) {
+ $( '.mw-editTools' ).find( 'a' ).each( function () {
+ $( this ).attr( 'tabindex', $val );
+ } );
+ }
+
+ // Change tabindex to 0 if user pressed spaced or enter while
focused
+ $( '.mw-editTools' ).on( 'keypress', function (e) {
+ // Don't continue if pressed key was not enter or
spacebar
+ if ( e.which !== 13 && e.which !== 32 )
+ return;
+
+ // Change tabindex only when element has focus
+ if ( $( this ).focus )
+ setEditTabindex( '0' );
+ } );
+
+ // Reset tabindex for elements when user focused out
mw-editTools
+ $( '.mw-editTools' ).on( 'focusout', function (e) {
+ // Check if user lost target focus
+ if ( e.relatedTarget === null )
+ setEditTabindex( '-1' );
+
+ // Check if relatedTarget is not inside mw-editTools
+ else if ( $( e.relatedTarget ).closest( '.mw-editTools'
).length === 0)
+ setEditTabindex( '-1' );
+ } );
+
+ // Set initial tabindex for mw-editTools to 0 and to -1 for all
links
+ $( '.mw-editTools' ).attr( 'tabindex', '0' );
+ setEditTabindex( '-1' );
+ } );
}( mediaWiki, jQuery ) );
--
To view, visit https://gerrit.wikimedia.org/r/395999
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2b581667aaf0f95c9c0f189f5bf5e852c12fd3cd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Divadsn <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits