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

Warning in console when using more than one Popover.Button inside Popover.Panel #2143

Closed
twittkopf opened this issue Jan 4, 2023 · 4 comments · Fixed by #2146
Closed

Warning in console when using more than one Popover.Button inside Popover.Panel #2143

twittkopf opened this issue Jan 4, 2023 · 4 comments · Fixed by #2146
Assignees

Comments

@twittkopf
Copy link

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

v1.7.7

What browser are you using?

Chrome

Reproduction URL

https://codesandbox.io/s/gracious-sinoussi-nlzl6e?file=/src/App.js

Describe your issue

When using more than one <Popover.Button /> inside <Popover.Panel /> to close the panel after click, I see the following warning in the console:

You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported.

Since using multiple <Popover.Button /> inside <Popover.Panel /> is a supported use case according to the docs, this seems to be an error. I'd expect the warning is only shown when using more than one <Popover.Button /> outside of <Popover.Panel /> because that use case is not supported.

After a check-in in Discord, it appears the current behaviour is indeed not as intended.

Related GitHub Discussion Thread

@RobinMalfait RobinMalfait self-assigned this Jan 4, 2023
RobinMalfait added a commit that referenced this issue Jan 4, 2023
…mponents (#2146)

* fix false positive warning about using multiple `<Popover.Button>` components

Fixes: #2143

* update changelog
@RobinMalfait
Copy link
Member

Hey! Thank you for your bug report!
Much appreciated! 🙏

This should be fixed by #2146, and will be available in the next release.

You can already try it (in a few minutes) using npm install @headlessui/react@insiders.

@michaelcais
Copy link

This false positive warning of multiple <Popover.Button> is happening again in @headlessui/[email protected]. I reverted back to previous version @headlessui/[email protected] and the warning disappears. All my app's <Popover.Button> components are inside a <Popover.Panel>.

@RobinMalfait
Copy link
Member

@michaelcais thank you, I'll take care of that!

@RobinMalfait
Copy link
Member

RobinMalfait commented Mar 3, 2023

@michaelcais Sorry about that!

This should be fixed by #2333, and will be available in the next release.

You can already try it using:

  • npm install @headlessui/react@insiders.

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 a pull request may close this issue.

3 participants