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 the the <Popover.Panel focus> closes correctly #1477

Merged
merged 2 commits into from
May 19, 2022

Conversation

RobinMalfait
Copy link
Member

This PR fixes an issue where the Popover.Panel isn't closed correctly if you are using the focus prop. This is because the idea behind the focus flag is that when the Popover.Panel opens the focus is moved inside the Popover.Panel. If the focus is moved outside of the Popover.Panel then the Popover.Panel will close again.

The issue with this is that the moment you click the Popover.Button when the Popover is open the
the following happens:

  1. Focus is moved to the Popover.Button.
  2. Popover will close due to the above.
  3. The click event happens on then Popover.Button.
  4. Which opens the Popover again.

This means that you can't close is anymore via click. This PR fixes that issue.

Fixes: #1342

@vercel
Copy link

vercel bot commented May 19, 2022

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

Name Status Preview Updated
headlessui-react ✅ Ready (Inspect) Visit Preview May 19, 2022 at 6:48PM (UTC)
headlessui-vue ✅ Ready (Inspect) Visit Preview May 19, 2022 at 6:48PM (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.Panel focus=true cause undesired open behavior when clicking multiple times on Popover.Button
1 participant