W3C home > Mailing lists > Public > public-css-archive@w3.org > January 2021

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

From: Manuel Rego Casasnovas via GitHub <sysbot+gh@w3.org>
Date: Fri, 22 Jan 2021 12:07:00 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-765353893-1611317219-sysbot+gh@w3.org>
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

This archive was generated by hypermail 2.4.0 : Tuesday, 19 October 2021 01:31:38 UTC