Page MenuHomePhabricator

accessKeyLabel not available in Firefox for addPortletLink
Closed, ResolvedPublic

Description

Firefox supports localized access key labels but only when the element is appended to the DOM tree:

$('<span>').attr('accesskey', 'g').appendTo('body')[0].accessKeyLabel
--> "Alt+Umschalt+g"

$('<span>').attr('accesskey', 'g')[0].accessKeyLabel
--> ""

mw.util.addPortletLink() calls updateTooltipAccessKeys() before appending to DOM tree, so the tooltip for the access key label is not localized:

mw.util.addPortletLink( 'p-views', '#', 'Foo', 't-foo', 'Foo tooltip', 'g' );
--> Tooltip is "Foo tooltip [alt-shift-g]".

Expected result:
--> Tooltip is "Foo tooltip [Alt+Umschalt-g]". (On a German Firefox)


Version: 1.24rc
Severity: minor

Details

Reference
bz67946

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 3:27 AM
bzimport set Reference to bz67946.
Fomafix created this task.Jul 13 2014, 12:07 PM

Change 145889 had a related patch set uploaded by Gerrit Patch Uploader:
Get localized access key tooltip mw.util.addPortletLink()

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

Change 160300 had a related patch set uploaded by Gerrit Patch Uploader:
jquery.accessKeyLabel: Append element into DOM on empty accessKeyLabel

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

Change 145889 merged by jenkins-bot:
mediawiki.util: Insert node before updating tooltip for accesskey

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

As I understand it this issue is fixed, with the jquery.accessKeyLabel patch being a more generic solution.

TheDJ added a subscriber: TheDJ.Nov 30 2014, 11:42 PM

a fix landed upstream on October 15th 2014 it seems.

Confirmed in Firefox Aurora 36.0a2. Detached elements now have a proper value in the accessKeyLabel property:

a = document.createElement('div')
<div>

a.accessKey = 'a'
"a"

a.accessKeyLabel
"⌃⌥a"