Page MenuHomePhabricator

Impossible to focus OptionsWidgets (ButtonOptionWidget, RadioOptionWidget) by accesskey, tabindex or otherwise
Closed, ResolvedPublic

Description

Steps to repeat.

  1. Navigate to en.wikipedia.org
  2. Open developer console.
  3. Paste: mw.loader.load('oojs-ui')
  4. Paste: $('body').append((new OO.ui.ButtonSelectWidget({items: [new OO.ui.ButtonOptionWidget({label: "foo", accessKey: "n"}), new OO.ui.ButtonOptionWidget({label: "bar", accessKey: "m"})]})).$element)
  5. Scroll to the bottom of the page and observe "foo" and "bar" button select group
  6. Press [ALT]+"n" and [ALT]+"m" a few times.

Expected:
Buttons would be selected appropriately when accessKeys are pressed

Actual:
Buttons do nothing!

Note that this bug might be related to https://phabricator.wikimedia.org/T98684

Event Timeline

Halfak raised the priority of this task from to Needs Triage.
Halfak updated the task description. (Show Details)
Halfak subscribed.
matmarex renamed this task from accessKey for ButtonOptionWidget does not work to Impossible to focus OptionsWidgets (ButtonOptionWidget, RadioOptionWidget) by accesskey, tabindex or otherwise.Aug 20 2015, 3:00 PM

This is unfortunately impossible to fix without non-trivial changes; see T107360.

On further thought, this is not true. Using the accesskey wouldn't have to focus the OptionWidget, it would have to select it in the parent SelectWidget and focus the parent, which probably can be done.

Change 285722 had a related patch set uploaded (by Bartosz Dziewoński):
SelectWidget/OptionWidget: Implement selecting by accesskey

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

@matmarex I'd be interested in the general philosophy behind our accesskey support? Our accessibility guidelines for developers are not mentioning accesskey at all. Citing from http://webaim.org/techniques/keyboard/accesskey accesskey in general is a “good idea implemented poorly” from accessibility perspective. The authors are stating, while it does make sense in a '"closed environment" web application', “some [users] may even be disadvantaged”.
Among the contra arguments are discoverability and language issues or clashing with key combinations already built into assistive technology.

@Volker_E MediaWiki uses accesskeys quite widely, for better of worse, and I imagine it just came up at some point as something OOjs UI was missing. I can't tell you why exactly it was implemented, the commit c4d369477a0a11538372a34d1cb898d72d8b7b9d predates me and doesn't have much explanation.

For example, the "Save page" button in the editor has "S" as the accesskey, and this was carried over to VisualEditor too (that might very well have been the reason why the accesskey feature was implemented in OOjs UI).

I think it's a reasonable feature to have, and we can leave the decision of using it to the application's developer. The general philosophy is that first of all, we strive to make OOjs UI not worse than plain HTML form controls, and I think supporting accesskeys fits with it.

(As a side note, MediaWiki solves some of the specific issues, e.g. making accesskeys localisable to different languages and displaying them in the hover tooltips of links/buttons they are defined for.)

Jdforrester-WMF moved this task from Reviewing to OOjs-UI-0.17.3 on the OOUI board.
Jdforrester-WMF edited projects, added OOUI (OOjs-UI-0.17.3); removed OOUI.
Jdforrester-WMF removed a project: Patch-For-Review.

Change 285722 merged by jenkins-bot:
SelectWidget/OptionWidget: Implement selecting by accesskey

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