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

Fix closing of Popover.Panel in React 18 #1409

Merged
merged 2 commits into from
May 5, 2022

Conversation

RobinMalfait
Copy link
Member

@RobinMalfait RobinMalfait commented May 5, 2022

This PR removes some unnecessary code that has been handled a different way and by doing that fixes a React 18 compatibility issue where the Popover would immediately close if you click anywhere inside of the Popover.Panel.

The reason for this is that we used the cleanup function of a useEffect to set the panel to null. In React 18, this will be executed twice therefore the Panel gets set to null while it didn't have to do that yet.

Fixes: #1407

@vercel
Copy link

vercel bot commented May 5, 2022

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

Name Status Preview Updated
headlessui-react ✅ Ready (Inspect) Visit Preview May 5, 2022 at 9:01PM (UTC)
headlessui-vue ✅ Ready (Inspect) Visit Preview May 5, 2022 at 9:01PM (UTC)

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.

Popover with transition closes while clicking inside (occurs only on react 18).
1 participant