-
-
Notifications
You must be signed in to change notification settings - Fork 285
Closed
Labels
accessibilitya11ya11ycomponent: tabsChanges related to the tabs component.Changes related to the tabs component.type: bugIt doesn't behave as expected.It doesn't behave as expected.
Milestone
Description
Bug report
Current behavior
When tabs and tabpanels are not given a value, and Tabs.Root is not provided with a value or defaultValue, the component automatically picks the first tab as the selected tab (hence why defaultValue has a default value of 0).
If a tab is disabled, it still gets automatically selected.
Expected behavior
- When no explicit selection is made by the consumer of the component (ie. via
valueordefaultValueprops), disabled tabs should not be picked as the initially selected tab. The first non-disabled tab should be picked instead - A disabled tab should still be selected if:
- The consumer explicitly sets it as selected (via
defaultValueorvalueprops) - The tab was selected while enabled, and later disabled
- The consumer explicitly sets it as selected (via
Reproducible example
https://codesandbox.io/p/sandbox/elated-microservice-wl4sl2
Notice how alert doesn't fire initially, while it fires for every subsequent user interaction.
Base UI version
1.0.0-beta.0
Which browser are you using?
Chrome
Which OS are you using?
Mac OS
Which assistive tech are you using (if applicable)?
N/A
Additional context
I understand this may be an opinionated take — in any case, whatever is decided, it shoud be applied to all components whenever a value changes for reasons outside of the consumer's control (and not just tabs).
Metadata
Metadata
Assignees
Labels
accessibilitya11ya11ycomponent: tabsChanges related to the tabs component.Changes related to the tabs component.type: bugIt doesn't behave as expected.It doesn't behave as expected.
Projects
Status
Recently completed