Last modified: 2014-04-26 16:25:42 UTC
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
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 :)
Spec draft: http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#dom-accesskeylabel Gecko (implemented): https://bugzilla.mozilla.org/show_bug.cgi?id=583533 WebKit (open bug): https://bugs.webkit.org/show_bug.cgi?id=72715
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