Page MenuHomePhabricator

mediawiki.util: Use accessKeyLabel property when available
Closed, ResolvedPublic

Description

mw.util uses much code and browser sniffing to display the access key in the tooltip. With HTML5 there is a property to simplify this, see [1].

Using it when available has the advantage that you don't have to figure out the correct prefix yourself, additionally it will be localized.

In Firefox 10 it works as expected:

$('#n-mainpage-description a').prop('accessKeyLabel')

"Alt+Umschalt+z"

The only drawback is that you still must provide a fallback for browsers not supporting this (including IE 9).

[1] http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#dfnReturnLink-0


Version: 1.17.x
Severity: enhancement

Details

Reference
bz37239

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 22 2014, 12:20 AM
bzimport set Reference to bz37239.
bzimport added a subscriber: Unknown Object (MLST).
Schnark created this task.May 31 2012, 9:34 AM

Very interesting. Thanks a lot for this.

Do we know what the browser support for this is (should we keep all the current fallbacks?)

(In reply to comment #1)

Very interesting. Thanks a lot for this.

I found this property more or less by accident when inspecting the DOM using Firebug.

Do we know what the browser support for this is (should we keep all the current
fallbacks?)

https://developer.mozilla.org/en/DOM/HTMLElement#Browser_compatibility only lists Firefox 8+. As I wrote, IE 9 doesn't support it. I didn't test other browsers. So the fallbacks have to be kept.

This could be a little annoying to implement (Firefox and friends, still the only browsers supporting it, seem to use a different format than MediaWiki – Alt+Shift+X instead of alt-shift-x) and not really worth it (because, again, no other browsers support this).

But if anybody feels like doing it, go ahead :)

Change 125426 had a related patch set uploaded by Umherirrender:
Add jquery.accessKeyLabel javascript module

https://gerrit.wikimedia.org/r/125426

Change 125426 merged by jenkins-bot:
Add jquery.accessKeyLabel javascript module

https://gerrit.wikimedia.org/r/125426