[csswg-drafts] [selectors] :focus-visible matches on initial programmatic focus (#5885)

mrego has just created a new issue for https://github.com/w3c/csswg-drafts:

== [selectors] :focus-visible matches on initial programmatic focus ==
* Spec: https://drafts.csswg.org/selectors/#the-focus-visible-pseudo

We have a test [`focus-visible-010.html`](https://wpt.fyi/results/css/selectors/focus-visible-010.html) that checks that a programmatic focus on the load event, causes that the element getting focused matches `:focus-visible`. This test passes in the 2 implementations of `:focus-visible` (Chromium and Firefox).

However the spec doesn't mention anything about this in the suggestions list, and given that 2 browsers follow that, and we have a test, maybe it'd be nice to add that to the list too.

The spec mentions 2 cases of programmatic focus:
> * 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.

But it doesn't mention what happens when there's no active element before the programmatic focus. WDYT?

CC @alice @emilio 

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5885 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 21 January 2021 23:26:09 UTC