-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Support <summary>
as a focusable element
#3389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support <summary>
as a focusable element
#3389
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Should |
ba9ab72
to
781c979
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Made some small adjustments. I noticed that if you do this:
<details>
Hello world
</details>
Then the details
element is focusable.
If you do this:
<details>
<summary>Hello world</summary>
</details>
Then the summary
element is focusable, but the details
is not focusable.
If you do this:
<details>
<div><summary>Hello world</summary></div>
</details>
Then the details
element is focusable again, but not the summary
.
So I adjusted the selectors to use this instead:
- summary
+ details:not(:has(> summary))
+ details>summary
This will now make sure that the summary
or the details
element is focusable but not both.
<summary>
is a built-in heading tag that is nested inside a<details>
tag to toggle its contents. It's keyboard tab-able by default and not currently recognized by Headless UI.tabindex="-1"
makes it behave like any other normally-tab-able element.