feat(@clayui/tabs): add new API to configure browsing behavior between tabs #5154
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.
Fixes #5151
In order to be able to control the automatic activation state of the tab when navigating, we have to have control of the active state, in the current implementation, the developer controls the state. In this PR I am applying the pattern from RFC 0002 Controlled and uncontrolled components to allow the component to have state visibility, this makes it possible during tab navigation when selecting a tab changes the current tab.
This makes it simpler to handle the active state of tabs. This component can be made simpler and provide some OOTB features, such as not needing to configure
aria-controls
to associate the tab with the panel, but this will only be possible when we start to apply the collection pattern in this component #5032.Also before that we need to review this component to improve the composition so that the
ClayTabs.Content
component doesn't become like sibling ofClayTabs
to improve the data flow, in this PR if theactive
is uncontrolled not work because it doesn't have how to pass the state ofactive
toClayTabs.Content
for it to work correctly needs to be controlled, so this is one of the reasons to refresh the composition of Tabs.