-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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: Make sure individual Tab
s are linked to the correct TabPanel
s
#57033
Conversation
3be5fd2
to
a057c42
Compare
Flaky tests detected in 2edf773. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7211402141
|
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.
This tests really well in SB! 🎉
I just left a couple of suggestions related to the tests, but they shouldn't be blockers.
…`s (#57033) * fix bug linking tabs to the correct tabpanels * add regression test * changelog * simplify tab content assertions
What?
Fixes a bug that prevented
Tabs
from explicitly linkingTab
sub-components to their respectiveTabPanel
counterparts.Why?
Ariakit.TabPanel
has an internaltabId
prop that I appear to have overlooked when first implementingTabs
. This is the prop responsible for declaring whichtab
element atabpanel
should be controlled by. Without it,Ariakit
falls back to linking the sub-components based on the order in which they're rendered. That's usually okay but definitely not always.I actually remember including this prop initially when starting work on
Tabs
, my best guess is that I mistook it for a typo at some point and removed it.How?
I've reinstated the
tabId
prop that's passed toAriakit
internally, and added a note to clarify the difference betweenid
(the DOM element's id) andtabId
in this instance.This does mean that
Ariakit
andTabs
each have atabId
prop that serve slightly different purposes, but they're closely enough related that I think it's okay.I've also added a new unit test for this to prevent any future regressions.
Testing Instructions
Tabs.TabPanel
sub-components so they're in a different order than the correspondingTabs.Tab
components.