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:
Fomafix
2018-09-10 06:48:42 +02:00
committed by jenkins-bot
parent dd390d2ec0
commit d052482cb0
2 changed files with 10 additions and 5 deletions

View File

@@ -387,7 +387,7 @@ class UniversalLanguageSelectorHooks {
'section' => 'personal/i18n',
// We use this class to hide this from no-JS users
'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>",
];

View File

@@ -382,10 +382,15 @@
// Bind language settings to preferences page link
$( '#uls-preferences-link' )
.click( function () {
$ulsTrigger.trigger( 'click', {
source: 'preferences'
} );
.on( 'click keypress', function ( e ) {
if (
e.type === 'click' ||
e.type === 'keypress' && e.which === 13
) {
$ulsTrigger.trigger( 'click', {
source: 'preferences'
} );
}
return false;
} );