Closed Bug 1506787 Opened 2 years ago Closed 2 years ago
Provide a way to make non-control XUL elements focusable but not tabbable
47 bytes, text/x-phabricator-request
|Details | Review|
Bug 1436086 will make browser toolbars navigable with the keyboard. Rather than every button being in the tab order (which would be pretty inefficient for users), groups of buttons will occupy a single tab stop, with left/right arrows being used to navigate within the group. This means that toolbar buttons need to be focusable but not in the tab order. (This includes <toolbarbutton>, but also other elements like <image> and <box> which are used as button-like things on toolbars.) It's possible to achieve this by temporarily setting -moz-user-focus to normal, calling element.focus(), then setting -moz-user-focus back to ignore. However, this is a pretty big hack and causes some weirdness for accessibility (and maybe other things). Also, this means that tests can't simply call element.focus() on toolbar buttons; they too must use this -moz-user-focus setting hack. I propose we add a new -moz-user-focus: no-tab value. We could alternatively allow tabindex="-1" like HTML, but this would mean changing the markup for every single button on the toolbar, which is likely to result in a lot of churn (and broken keyboard access in future).
This is similar to tabindex="-1", but non-control XUL elements don't support that. It will primarily be useful for buttons on toolbars, which will be grouped under a single tab stop for efficiency.
Oops. Wrong try push. Correct one: https://treeherder.mozilla.org/#/jobs?repo=try&revision=08276f3fe1e5c7be608483bc53d5f4568ee7dba1
After review comments and discussion, I'm switching to tabindex="-1" instead, which is more standard/future proof. Try run: https://treeherder.mozilla.org/#/jobs?repo=try&revision=d8e0a570e0cc55401c2782e9208e5e3a716ebf91
Previously, the tabindex attribute wasn't supported on non-control XUL elements at all. The only way to make those focusable was to use -moz-user-focus: normal. However, that caused the element to be included in the tab order; there was no way to make it focusable but not tabbable. This can now be achieved using tabindex="-1". This will primarily be useful for buttons on toolbars, which will be grouped under a single tab stop for efficiency. For consistency, this also changes the behaviour of tabindex="-1" with -moz-user-focus: ignore on XUL controls. Previously, -moz-user-focus: ignore would override tabindex="-1", making the element unfocusable. Now, the tabindex attribute always overrides if explicitly specified.
Pushed by email@example.com: https://hg.mozilla.org/integration/autoland/rev/38844846c6ae Support tabindex attribute (including value -1) on non-control XUL elements. r=smaug
You need to log in before you can comment on or make changes to this bug.