Re: [csswg-drafts] [css-ui] outline is not visible when moving focus programmatically (#4421)

Ah, looks like CSS _does_ define this, as ["non-normative suggestions"](https://drafts.csswg.org/selectors-4/#focus-visible-pseudo):

> - If the active element matches :focus-visible, and a script causes focus to move elsewhere, the newly focused element should match :focus-visible.
> 
> - Conversely, if the active element does not match :focus-visible, and a script causes focus to move elsewhere, the newly focused element should not match :focus-visible.

It's that last point that is problematic. Example case: I click on a custom select box to focus it, then use the arrows to cycle through the options. The original focus of the box may not have required a focus ring, but the keyboard actions do need one.

I would therefore recommend removing that last bullet point from CSS UI, and beyond that I'd hope browsers would add some heuristics for identifying which user interaction caused the change in focus (as Alice mentions [on the HTML issue](https://github.com/whatwg/html/issues/5004#issuecomment-541976527)).

-- 
GitHub Notification of comment by AmeliaBR
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4421#issuecomment-542395971 using your GitHub account

Received on Tuesday, 15 October 2019 20:42:58 UTC