Linux applying :-moz-focusring to buttons even without keyboard interaction feels off
Categories
(Core :: DOM: UI Events & Focus Handling, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox78 | --- | fixed |
People
(Reporter: Gijs, Assigned: emilio)
References
Details
Attachments
(4 files, 1 obsolete file)
On Windows, we only start showing focus rings once the user uses the keyboard to move focus in the document. That feels like a more natural choice.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 1•5 years ago
|
||
Just a quick note, because I'm going to bed so not gonna write the patch right now: GTK behavior seems to be (from playing with gtk3-demo and gkt3-widget-factory) to show focus rings only after keyboard interaction.
So I think this is a matter of a pref flip. There's probably more stuff to be cleaned up afterwards though.
Assignee | ||
Comment 2•5 years ago
|
||
Gijs, are you sure of comment 0?
data:text/html,<style>:-moz-focusring { outline: 10px solid red }</style><button style="background: blue">foo
Shows a red outline on windows... Whether it should is another matter I guess, but...
Assignee | ||
Comment 3•5 years ago
|
||
Huh, I lie, that's from browserstack apparently...
Assignee | ||
Comment 4•5 years ago
|
||
This makes us closer to the GTK behavior (not showing outlines until
we've navigated with the keyboard).
Updated•5 years ago
|
Assignee | ||
Comment 5•5 years ago
|
||
Depends on D75501
Assignee | ||
Comment 6•5 years ago
|
||
This is useful for non-native theme too, and shouldn't change behavior
in other themes.
This is so that we don't need to pile up ifdefs in nsNativeTheme, and so
that the GTK theme doesn't change behavior with the following patches.
Instead of hackily remove the FOCUS bit, make the theme check for the
FOCUSRING bit, which is the right thing to check for anyway.
Depends on D75502
Assignee | ||
Comment 7•5 years ago
|
||
Instead move the check to the focus manager, more similar to how
focus-visible works.
Now nsGlobalWindowInner::ShouldShowFocusRing means "Should we show focus
ring for anything in this window", that is: Have we keyboard-navigated
in this window, or do we have a pref that says that we should always
show focus rings.
Fix some callers appropriately (some of them that were not properly
accounting for the element being focused in the first place...).
Depends on D75503
Assignee | ||
Comment 8•5 years ago
|
||
The Mac focus model is a bit different (mouse doesn't focus form
controls for example).
This matches GTK3 to my knowledge, where outlines are not shown until
you've navigated with the keyboard.
We should maybe consider changing Android as well (and maybe all
platforms, actually), but that's a bit of a bigger endeavour.
Depends on D75504
Assignee | ||
Comment 9•5 years ago
|
||
ok, so apparently whether we always show focus rings on windows depends on some system setting, which is default false. I got a bit driven away cleaning up this code but I think the end state is better.
Assignee | ||
Comment 10•5 years ago
|
||
This is also useful work for :focus-visible
and such.
Assignee | ||
Updated•5 years ago
|
Comment 11•5 years ago
|
||
Comment 12•5 years ago
|
||
Comment 13•5 years ago
|
||
Backed out for failures on test_focusrings.xhtml
backout: https://hg.mozilla.org/integration/autoland/rev/8baffa98bf72c951e2bb20769bb9fc3d82199722
push: failure appeared on a subsequent push https://treeherder.mozilla.org/#/jobs?repo=autoland&selectedTaskRun=RG_f0ohwQTywzlxs0zt1xQ-0&revision=b2881b76bd3b7acc8f76cb059a0dd216d899bce6&searchStr=os%2Cx%2C10.14%2Cdebug%2Cmochitests%2Cwithout%2Ce10s%2Ctest-macosx1014-64%2Fdebug-mochitest-chrome-1proc-2%2Cm-1proc%28c2%29
failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=302507483&repo=autoland&lineNumber=109982
[task 2020-05-15T21:09:41.617Z] 21:09:41 INFO - TEST-START | dom/tests/mochitest/general/test_focusrings.xhtml
[task 2020-05-15T21:09:42.716Z] 21:09:42 INFO - GECKO(2047) | [2047, Main Thread] WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80004005 (NS_ERROR_FAILURE): file /builds/worker/checkouts/gecko/dom/base/nsContentUtils.cpp, line 3734
[task 2020-05-15T21:09:42.807Z] 21:09:42 INFO - GECKO(2047) | [2047, Main Thread] WARNING: NS_ENSURE_TRUE(presShell) failed: file /builds/worker/checkouts/gecko/dom/base/nsGlobalWindowOuter.cpp, line 4263
[task 2020-05-15T21:09:42.838Z] 21:09:42 INFO - TEST-INFO | started process screencapture
[task 2020-05-15T21:09:42.957Z] 21:09:42 INFO - TEST-INFO | screencapture: exit 0
[task 2020-05-15T21:09:42.957Z] 21:09:42 INFO - Buffered messages logged at 21:09:42
[task 2020-05-15T21:09:42.957Z] 21:09:42 INFO - must wait for load
[task 2020-05-15T21:09:42.958Z] 21:09:42 INFO - TEST-PASS | dom/tests/mochitest/general/test_focusrings.xhtml | unfocused shows no ring
[task 2020-05-15T21:09:42.958Z] 21:09:42 INFO - Buffered messages finished
[task 2020-05-15T21:09:42.958Z] 21:09:42 INFO - TEST-UNEXPECTED-FAIL | dom/tests/mochitest/general/test_focusrings.xhtml | focus shows ring
[task 2020-05-15T21:09:42.958Z] 21:09:42 INFO - SimpleTest.ok@chrome://mochikit/content/tests/SimpleTest/SimpleTest.js:299:16
[task 2020-05-15T21:09:42.958Z] 21:09:42 INFO - runTest@chrome://mochitests/content/chrome/dom/tests/mochitest/general/test_focusrings.xhtml:48:7
[task 2020-05-15T21:09:42.958Z] 21:09:42 INFO - SimpleTest.waitForFocus/waitForFocusInner/focusedOrLoaded/<@chrome://mochikit/content/tests/SimpleTest/SimpleTest.js:918:23
[task 2020-05-15T21:09:42.958Z] 21:09:42 INFO - TEST-PASS | dom/tests/mochitest/general/test_focusrings.xhtml | initial appearance
[task 2020-05-15T21:09:42.958Z] 21:09:42 INFO - TEST-PASS | dom/tests/mochitest/general/test_focusrings.xhtml | mouse click on <button id='elem'>Button</button>
[task 2020-05-15T21:09:42.959Z] 21:09:42 INFO - TEST-PASS | dom/tests/mochitest/general/test_focusrings.xhtml | mouse click on <button id='elem'>Button</button> ring
Comment 14•5 years ago
|
||
bugherder |
Assignee | ||
Updated•5 years ago
|
Comment 15•5 years ago
|
||
Updated•5 years ago
|
Comment 16•5 years ago
|
||
bugherder |
Updated•5 years ago
|
Comment 17•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Comment 18•5 years ago
|
||
Comment 19•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/bdfe90f8088e
https://hg.mozilla.org/mozilla-central/rev/72afaabad8ca
https://hg.mozilla.org/mozilla-central/rev/acf55c958a83
Description
•