-
Notifications
You must be signed in to change notification settings - Fork 1.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
Tab.Group's selectedIndex is buggy. #1049
Comments
Hey! Thank you for your bug report! Thank you for providing the tests as well! This should be fixed by #1050, and will be available in the next release. You can already try it using:
|
I'm still experiencing this and the @insiders version gives me import errors
|
@brvnonascimento can you create a minimal reproduction repo and share that? Also make sure to remove any caches like the |
The problem (under Tabs.Tab = styled(Tab)`
background: red;
`; Probably very specific to Linaria. However, I'm still experiencing the bug when |
The bug was caused by having the Tab.Panel being wrapped by a React Spring's animated.div component. |
What package within Headless UI are you using?
@headlessui/react
@headlessui/vue
What version of that package are you using?
v1.4.3
What browser are you using?
Chrome
Reproduction URL
RyogaK/headlessui@main...RyogaK:tab-selectedindex-bug-reproduce
Describe your issue
When switching tabs using the selectedIndex prop in Tab.Group, it behaves as if the selected index in the appearance is not the same as the selected index in the internal state.
(e.g.) If the initial state of selectedIndex is set to 0 and later changed to 1, the tab 1 looks correctly displayed, but the behavior when clicking on the tabs remain the same as when 0 is selected. When I click on tab 0, it doesn't switch, probably because internally it has already determined that it is 0. When I click on tab 1, it looks like it is already tab 1, but onChange is called again to transition to tab 1.
There is a fork with test code that reproduces this.
The text was updated successfully, but these errors were encountered: