:focus-visible does not match for programmatic keyboard focus after mouse click
Categories
(Core :: DOM: UI Events & Focus Handling, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox90 | --- | verified |
People
(Reporter: nolan, Assigned: emilio)
References
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0
Steps to reproduce:
- Go to https://bl.ocks.org/nolanlawson/raw/0a0f8531087f9031d219028532d4054a/
- Click the button with the mouse
- Press the arrow down key on the keyboard
Actual results:
A red focus outline is not visible.
Expected results:
A red focus outline should be visible on the first item in the feed list.
This issue is only reproducible in Firefox (including Nightly 90.0a1). It does not repro in Chrome or in Safari Technology Preview 14.2 with the ":focus-visible pseudo-class" runtime flag set.
The issue seems to be that Firefox's :focus-visible heuristics do not treat programmatic keyboard focus the same as the Tab key. On this same page, you can click the button with the mouse and press Tab, and the focus outline is shown.
Real-world use case: in my social media app (https://pinafore.social), I implement keyboard shortcuts to change focus for articles in the feed. But if the user is a mixed mouse-keyboard user who clicks on something with the mouse and then attempts to use keyboard shortcuts, then the focus outline is not shown.
Comment 1•3 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•3 years ago
|
||
Updated•3 years ago
|
Updated•3 years ago
|
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/fb2578c42229 Consider programmatic focus during keyboard input as key focus. r=smaug
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/29017 for changes under testing/web-platform/tests
Comment 6•3 years ago
|
||
bugherder |
Upstream PR merged by moz-wptsync-bot
Updated•3 years ago
|
Comment 8•3 years ago
|
||
I have reproduced this on an affected Nightly build 90.0a1 (2021-05-13).
Confirming this issue as verified fixed on Win 10x64, Ubuntu 20.04 and macOS 10.15, using Firefox 90.0b5 (2021-06-08).
Thanks!
Description
•