Hi,
In bug 1617600 I plan to land a patch to implement :focus-visible,
behind a pref, on by default on Nightly / Early Beta.
Summary: Implement the :focus-visible pseudo-class, which is like
:focus, but with heuristics about when _not_ to show focus rings, for
example.
This is similar in intent to :-moz-focusring, but not in behavior. In
particular, :-moz-focusring is stateful, and all-or-nothing. Once you've
tab-navigated in a window, _everything_ shows focus rings. See comments
in bug 1445482 about why that doesn't match developers' expectations.
For now the heuristic I'm going to implement is quite simple: We don't
match the pseudo-class if focused via mouse / touch, and we do
otherwise. This heuristic will almost-surely need tweaking. Simple
example: we probably want to match the pseudo-class unconditionally for
editable elements and such. By providing an early implementation, the
idea is for Nightly / Dev Edition users and developers to file bugs
against it as needed.
We should consider also add a preference to always match focus-visible
users with higher accessibility needs, etc... I'll make sure to check
with the a11y team about this. This all should be pretty easy to implement.
The idea here is that we could eventually alias our :-moz-focusring
pseudo-class to be :focus-visible.
Bug: Main bug for the feature is bug 1445482. Bug for the initial
implementation is above.
Pref: layout.css.focus-visible.enabled
Standard: https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo
Platform coverage: all
DevTools bug: I filed bug 1617608 to allow toggling the pseudo-class. I
don't think there's much else needed but let me know if you think otherwise.
Other browsers:
* WebKit: Not implemented yet:
https://bugs.webkit.org/show_bug.cgi?id=185859
* Chromium: Behind a flag, work ongoing in
https://bugs.chromium.org/p/chromium/issues/detail?id=817199
web-platform-tests: There are some basic tests in
https://wpt.fyi/results/css/selectors?label=master&label=experimental&aligned&q=focus-visible
(with some manual tests in that directory as well). This feature
involves heuristics so not all the tests may qualify as non-tentative
WPT (though I plan to land our tests for features that developers
request with .tentative suffix).
Secure contexts: Not restricted to secure context, as many related CSS
features.
Is this feature enabled by default in sandboxed iframes? Yes
-- Emilio
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform