Re: Questions about the :focus-visible heuristics

On 2/19/21 00:30, Tab Atkins Jr. wrote:
> Well, Chrome draws a focus ring on that element on click too, so it's
> still consistent. I guess Firefox does treat them differently, but at
> least with regards to the "pay attention to what was previously
> focused" text, both seem to ignore what was previously focused.

Chrome Dev does not. Chrome stable doesn't match :focus-visible on 
click, either, it shows an outline because of a bug that has been fixed 
by rego already (Chrome was using :focus in the UA sheet rather than 
:focus-visible).

Also, I don't think we both ignore what was previously focused, see this 
test-case for example, which in Firefox correctly makes the <div> match 
:focus-visible because the previously focused element did:

<!doctype html>
<input placeholder="When you focus me..." 
onfocus="this.nextElementSibling.focus()">
<div tabindex="0">
   ... I should take focus and draw an outline
</div>

And this one, where it doesn't show a ring for the same reason:

<!doctype html>
<div tabindex="0" onfocus="this.nextElementSibling.focus()">
   When you focus me with mouse...
</div>
<div tabindex="0">
   ... I should take focus and _not_ draw an outline
</div>

If you have a test-case where that doesn't happen, I'd be interested in 
taking a look, I wrote that line of code[1] :)

[1]: 
https://searchfox.org/mozilla-central/rev/e84baf5c730abd453be5d50dcb0aba1e743bac47/dom/base/nsFocusManager.cpp#1217

  -- Emilio

Received on Friday, 19 February 2021 00:09:40 UTC