Last modified: 2014-10-03 09:49:11 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T67010, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 65010 - Localized brackets can break accesskey handling
Localized brackets can break accesskey handling
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
1.24rc
All All
: Normal normal (vote)
: 1.24.0 release
Assigned To: Fomafix
: accessibility, i18n
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-05-07 17:47 UTC by Umherirrender
Modified: 2014-10-03 09:49 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Umherirrender 2014-05-07 17:47:04 UTC
Since Gerrit change #90892 the [] for accesskeys are used from message 'brackets', when using other brackets (like '()') there, the regex in module jquery.accessKeyLabel gets not matched, because the [] are hard coded. Same for the word-seperator, when no space is used the regex will also not match:

oldTitle.replace( / \[.*?\]$/, '' )

After fix of bug 48505 there are now two accesskey hints. The default accesskey hint and one with [] and the right buttons (like alt or ctrl), because it is always added.
Comment 1 Umherirrender 2014-05-07 18:43:43 UTC
The hardcoded brackets and space is replaced in Gerrit change #132009, but I have no idea to build a safe regex from that messages.
Comment 2 Gerrit Notification Bot 2014-05-08 11:57:26 UTC
Change 132009 had a related patch set uploaded by Gerrit Patch Uploader:
jquery.accessKeyLabel: Replace hardcoded brackets and space

https://gerrit.wikimedia.org/r/132009
Comment 3 Bartosz Dziewoński 2014-05-08 14:23:55 UTC
(In reply to Umherirrender from comment #1)
> I have no idea to build a safe regex from that messages.

It might be easier to just cache the original tooltips somewhere and do away with the regex entirely. We'd just have to be extra careful about being compatible with dynamically changing tooltips (like in mediawiki.page.watch.ajax.js).

Maybe we could use jQuery attr hooks for this? http://blog.rodneyrehm.de/archives/11-jQuery-Hooks.html (Just a thought, I didn't look into this in detail.)
Comment 4 Fomafix 2014-05-09 06:18:26 UTC
The original tooltip is the tooltip from PHP. This contains title text and the access key text at the end for compatibility with clients without JavaScript. Without regex the title text has to transfered on a alternative way to JavaScript. mediawiki.page.watch.ajax.js has this because it changes the title text. When a script changes only the access key and without changing the title text the title text is normally not available and the regex is necessary to extract the title text from the tooltip.

attr hook seams to be a good idea.
Comment 5 Gerrit Notification Bot 2014-05-13 20:42:42 UTC
Change 132009 merged by jenkins-bot:
jquery.accessKeyLabel: Replace hardcoded brackets and space

https://gerrit.wikimedia.org/r/132009
Comment 6 Umherirrender 2014-05-14 05:06:12 UTC
Was successfully merged
Comment 7 Fomafix 2014-10-03 09:49:11 UTC
(In reply to Bartosz Dziewoński from comment #3)
> Maybe we could use jQuery attr hooks for this?
> http://blog.rodneyrehm.de/archives/11-jQuery-Hooks.html (Just a thought, I
> didn't look into this in detail.)

The MutationObserver would also be a possible solution. [1] [2]
This should even work when the attributes get changed without jQuery.
But it is not supported by IE < 11. [3]

[1] http://www.w3.org/TR/dom/#interface-mutationobserver
[2] https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
[3] http://caniuse.com/#feat=mutationobserver

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links