[Webkit-unassigned] [Bug 225148] [selectors] :focus-visible and keyboard events
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sat May 8 14:33:59 PDT 2021
https://bugs.webkit.org/show_bug.cgi?id=225148
--- Comment #21 from Maciej Stachowiak <mjs at apple.com> ---
(In reply to Rob Dodson from comment #16)
> One of the intentions of :focus-visible is to not match if someone
> mouse-clicks on a div (or other generic element) with a tabindex because
> developers often build custom controls using generic elements and when they
> unexpectedly show a focus ring on mouse click these same developer reach for
> :focus { outline: none; } which we really want to discourage.
>
> The spec attempts to explain that :focus-visible should not match when you
> mouse click an element with a tabindex, but does so in a way that maybe
> isn't explicit enough. Quoting from the spec:
Everything you're quoting is from a non-normative Example, which starts with: "User agents can choose their own heuristics for when to indicate focus; however, the following (non-normative) suggestions can be used as a starting point".
In other words, none of it is a requirement, it's just a suggestion of one possible way to do it. It's not even a SHOULD-level recommended requirement or a MAY-level optional requirement. If the spec intended to create a normative requirement, presumably it would have done so.
All that said, I'm not sure we have strong feelings about what happens when the user clicks a tabindex-focusable generic element that is not obviously set up to receive typing. So long as behavior for built-in controls is not affected.
>
>
> > We should try to show it right away in places we believe will receive typing, even if the user clicked to focus it in the first place.
>
> I think(?) we all agree that if you're clicking on a control that can
> receive text input, or an element with contenteditable, that we should show
> a ring. If that's not happening maybe it's a bug in the implementation or
> perhaps I'm missing something
This comment was in response to a suggestion that we should start showing a focus ring once a user presses a key after mouse-focusing an element. I'm not sure what problem that was trying to solve but it's not a good solution.
>
> > Incidentally, perhaps this UA stylesheet rule to suppress drawing a focus ring in some cases should instead be changed to be part of the definition of :focus-visible (and then other UA stylesheet rules should use :focus-visible instead of :focus).
>
> For what it's worth I think it is called out at the end of the
> :focus-visible spec that browser should switch the UA stylesheet to use the
> :focus-visible behavior:
>
> > User agents should also use :focus-visible to specify the default focus style, so that authors using :focus-visible will not also need to disable the default :focus style.
It looks like the definition of :focus-visible in WebKit has not yet been aligned with the exceptions above, and the UA stylesheet has not been converted to use :focus-visible instead of :focus.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210508/ef3ebbc0/attachment.htm>
More information about the webkit-unassigned
mailing list