Use <a> instead of <a href="#"> for JavaScript click events
* No status line with URL and "#". * No new tab on middle click. tabindex="0" ensures to have the normal tab order. role="button" according to https://www.mediawiki.org/wiki/Accessibility_guide_for_developers Change-Id: I82f1923b3905f111ce7719c03a3919633271720a
This commit is contained in:
@@ -387,7 +387,7 @@ class UniversalLanguageSelectorHooks {
|
|||||||
'section' => 'personal/i18n',
|
'section' => 'personal/i18n',
|
||||||
// We use this class to hide this from no-JS users
|
// We use this class to hide this from no-JS users
|
||||||
'cssclass' => 'uls-preferences-link-wrapper',
|
'cssclass' => 'uls-preferences-link-wrapper',
|
||||||
'default' => "<a id='uls-preferences-link' href='#'>" .
|
'default' => "<a id='uls-preferences-link' role='button' tabindex='0'>" .
|
||||||
wfMessage( 'ext-uls-language-settings-preferences-link' )->escaped() . "</a>",
|
wfMessage( 'ext-uls-language-settings-preferences-link' )->escaped() . "</a>",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -382,10 +382,15 @@
|
|||||||
|
|
||||||
// Bind language settings to preferences page link
|
// Bind language settings to preferences page link
|
||||||
$( '#uls-preferences-link' )
|
$( '#uls-preferences-link' )
|
||||||
.click( function () {
|
.on( 'click keypress', function ( e ) {
|
||||||
$ulsTrigger.trigger( 'click', {
|
if (
|
||||||
source: 'preferences'
|
e.type === 'click' ||
|
||||||
} );
|
e.type === 'keypress' && e.which === 13
|
||||||
|
) {
|
||||||
|
$ulsTrigger.trigger( 'click', {
|
||||||
|
source: 'preferences'
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} );
|
} );
|
||||||
|
|||||||
Reference in New Issue
Block a user