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

I think we should consider 2 cases:
1. Script focus on load event or via `autofocus`.
```html
<div id="target" tabindex="0">Target</div>
<script>
  window.addEventListener("load", () => target.focus());
</script>
```
2. Script focus at any point when there's no current active element.
```html
<div id="target" tabindex="0">Target</div>
<script>
  setTimeout(() => target.focus(), 1000);
</script>
```

I guess we want `:focus-visible` to match in both cases, at least that's what Chromium and Firefox do.


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


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

Received on Friday, 22 January 2021 12:07:02 UTC