-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Tabs: override tablist's tabindex only when necessary #66209
Conversation
Flaky tests detected in 7619679. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11386979837
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
Makes sense and tests as expected 👍 🚀
Might need to tweak a bit if #66208 lands first.
7619679
to
3300ba1
Compare
Co-authored-by: ciampo <[email protected]> Co-authored-by: tyxla <[email protected]>
What?
Extracted from #66097 (comment)
This PR tweaks the
Tabs.Tablist
component so that the element's tabbability is primarily controlled by ariakitWhy?
Currently the tablist element has a fixed
tabIndex={-1}
, which is in place to prevent browsers from focussing the tablist when it's a scroll container — we want to opt out from it since the component knows how to handle keyboard scrolling without interference from the browser.But this override is a bit too invasive and prevents
ariakit
from settingtabindex={0}
when the selected tab id isnull
— in that case, in fact, the tablist is meant to be tabbable.How?
Tweak the tablist code, giving priority to ariakit's
tabIndex
value and only settingtabIndex={-1}
if a value fromariakit
is not provided.Testing Instructions
Tab
componentselectedTabId
tonull