Repository navigation
[tabs] Do not initially select a disabled tab - #3475
Merged
Merged
Conversation
commit: |
Bundle size report
Check out the code infra dashboard for more information about this PR. |
michaldudak
force-pushed
the
initial-disabled-tab
branch
from
December 9, 2025 11:21
bb55cec to
78802a2
Compare
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
michaldudak
marked this pull request as draft
December 9, 2025 11:25
michaldudak
marked this pull request as ready for review
December 9, 2025 12:18
LukasTy
reviewed
Dec 9, 2025
LukasTy
approved these changes
Dec 10, 2025
| /** | ||
| * Whether the Tab is disabled. | ||
| * | ||
| * If a first Tab on a TabList is disabled, it won't initially be selected. |
Member
There was a problem hiding this comment.
Suggested change
| * If a first Tab on a TabList is disabled, it won't initially be selected. | |
| * If a first Tab on a `<Tabs.List>` is disabled, it won't initially be selected. |
| * | ||
| * If a first Tab on a TabList is disabled, it won't initially be selected. | ||
| * Instead, the next enabled Tab will be selected. | ||
| * However, this does not work this way during Server-Side Rendering, as it is not known |
Member
There was a problem hiding this comment.
Suggested change
| * However, this does not work this way during Server-Side Rendering, as it is not known | |
| * However, it does not work like this during Server-Side Rendering, as it is not known |
| * Instead, the next enabled Tab will be selected. | ||
| * However, this does not work this way during Server-Side Rendering, as it is not known | ||
| * during pre-rendering which Tabs are disabled. | ||
| * To work around this, ensure that `defaultValue` or `value` on `Tabs.Root` is set to an enabled Tab's value. |
Member
There was a problem hiding this comment.
Suggested change
| * To work around this, ensure that `defaultValue` or `value` on `Tabs.Root` is set to an enabled Tab's value. | |
| * To work around it, ensure that `defaultValue` or `value` on `<Tabs.Root>` has the value of an enabled Tab. |
michaldudak
force-pushed
the
initial-disabled-tab
branch
from
December 10, 2025 12:47
bdda2c9 to
3efdc42
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a solution inspired by #2579 adapted to the current state where
valueis mandatory on Tab and TabPanel parts.Due to how tabs are registered, this doesn't work with SSR - we don't know which tabs are disabled on the server. To overcome this, explicitly provide a
defaultValuepointing to the first non-disabled tab.Fixes #2098