:focus-visible - JS-based focus() on back nav treated as keyboard input
Categories
(Core :: DOM: UI Events & Focus Handling, defect, P2)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox88 | --- | fixed |
People
(Reporter: nolan, Assigned: emilio)
References
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:86.0) Gecko/20100101 Firefox/86.0
Steps to reproduce:
- Go to https://bl.ocks.org/nolanlawson/raw/1aa0892f7b2c831c7bb6da5242e1e3bc/
- Click "About page" with the mouse
- Click the browser back button with the mouse (or type Alt-Left)
Actual results:
The "About page" link has a red outline (indicating focus).
Expected results:
The red outline should not be visible, due to the CSS:
:focus:not(:focus-visible) {
outline: none;
}
In Chrome's implementation of :focus-visible, the back button is not treated as keyboard input. The same repro steps on Chrome will not result in the red focus outline being shown.
Note that this page is simulating a typical "SPA" behavior for a website – on navigation, the DOM is cleared, and focus is manually applied with JavaScript using element.focus() to the "last" previously-focused element. This seems to be the behavior that causes the difference between Chrome and Firefox.
Note that I'm on Linux (Ubuntu 20.04.2 LTS), in case that makes a difference.
Comment 1•5 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::DOM: UI Events & Focus Handling' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
| Assignee | ||
Comment 2•5 years ago
|
||
What we implemented before this patch was basically what the heuristics
in the spec said, which used to be normative:
https://drafts.csswg.org/selectors/#the-focus-visible-pseudo
That has become non-normative and there's ongoing discussion on what
should happen for cases like this in:
https://github.com/w3c/csswg-drafts/issues/5885
https://github.com/web-platform-tests/wpt/pull/27806
There seems to be agreement on that WPT issue on cases like this one, so
let's make it work.
Updated•5 years ago
|
| Reporter | ||
Comment 3•5 years ago
|
||
Thank you!
| Assignee | ||
Updated•5 years ago
|
Updated•5 years ago
|
Comment 5•5 years ago
|
||
Backed out for causing mochitest failures in test_focusrings and reftest failures.
Backout link: https://hg.mozilla.org/integration/autoland/rev/de1a1b350e9e0fb606cc7f5b709df544af8dd313
| Assignee | ||
Updated•5 years ago
|
Comment 7•5 years ago
|
||
Backed out for causing reftest failures on windows.
Backout link: https://hg.mozilla.org/integration/autoland/rev/2da93849a4212b527560aa16f8af10367c3d98c9
Comment 10•5 years ago
|
||
Comment 11•5 years ago
|
||
Comment 12•5 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/9dbf6cfd01d7
https://hg.mozilla.org/mozilla-central/rev/905e808d63cc
https://hg.mozilla.org/mozilla-central/rev/f5d1e34c1db8
Description
•