TitleOptionWidget: don't subvert OptionWidget's tabindex
authorDavid Lynch <dlynch@wikimedia.org>
Tue, 5 Jul 2016 16:24:04 +0000 (11:24 -0500)
committerDavid Lynch <dlynch@wikimedia.org>
Tue, 5 Jul 2016 17:08:10 +0000 (12:08 -0500)
OptionWidget takes steps to not interfere in the tab order. TitleOptionWidget
uses links as its labels, which has a side-effect of reintroducing a tab-
focusable element into the OptionWidget. Explicitly set tabindex="-1" on these
links, to maintain the OptionWidget behavior.

Bug: T129792
Change-Id: Ia6b1361e7183e253b7abc58037f007936dfa60ff

resources/src/mediawiki.widgets/mw.widgets.TitleOptionWidget.js

index 84533aa..37e6e1a 100644 (file)
                this.$label.attr( 'href', config.url );
                this.$element.addClass( 'mw-widget-titleOptionWidget' );
 
+               // OOUI OptionWidgets make an effort to not be tab accessible, but
+               // adding a link inside them would undo that. So, explicitly make it
+               // not tabbable.
+               this.$label.attr( 'tabindex', '-1' );
+
                // Allow opening the link in new tab, but not regular navigation.
                this.$label.on( 'click', function ( e ) {
                        // Don't interfere with special clicks (e.g. to open in new tab)