Skip to content
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

Ensure controlled Tabs don't change automagically #1680

Merged
merged 2 commits into from Jul 15, 2022
Merged

Conversation

RobinMalfait
Copy link
Collaborator

This PR fixes an issue where the Tabs component behaves incorrectly if it is used in a controlled way. If you are controlling the Tabs, then clicking on the tabs should fire the onChange/@change but it should not actually switch tabs, you are in charge of that.

Fixes: #1509

@vercel
Copy link

vercel bot commented Jul 15, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
headlessui-react ✅ Ready (Inspect) Visit Preview Jul 15, 2022 at 2:50PM (UTC)
headlessui-vue ✅ Ready (Inspect) Visit Preview Jul 15, 2022 at 2:50PM (UTC)

When the `Tabs` component is used ina a controlled way, then clicking on
a tab should call the `onChange` callback, but it should not change the
actual tab internally.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Controlled mode for Tabs component in React does not work
1 participant