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

TabGroup's onChange occurs when data list changes #3566

Open
helloheesu opened this issue Nov 20, 2024 · 0 comments
Open

TabGroup's onChange occurs when data list changes #3566

helloheesu opened this issue Nov 20, 2024 · 0 comments

Comments

@helloheesu
Copy link

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

v2.2.0

What browser are you using?

Arc on Mac

Reproduction URL

https://codesandbox.io/p/devbox/6qfgh2

Describe your issue

Please check the above reproduction URL.

Given assumtion:

  • spaces are given which will be tab header list
  • spaces could be updated from outside
  • selectedSpaceId will also be given and could be changed from outside

What I wanted:

When I click 'up' or 'down' button to update spaces,
I wanted to keep that space focused, just moved the order.

The problem:

even though I didn't updated selectedSpaceId or selectedIndex,
<TabGroup />'s onChange occurs and gives its old selectedIndex.
I think its behavior feels more like defaultSelectedIndex than selectedIndex compared to any other controlled form components from other libraries, (i.e. react's text input component).

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

No branches or pull requests

1 participant