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 outside click detection when component is mounted in the Shadow DOM #2866

Merged
merged 3 commits into from
Dec 5, 2023

Conversation

thecrypticace
Copy link
Contributor

If a component (like a <Popover>) was mounted inside the Shadow DOM we wouldn't handle outside clicks correctly. Our outside click handling has to detect "3rd-party" elements in the DOM to make sure interacting with things like Grammarly still work. In Next.js the app is wrapped in a div (in non RSC situations) and, when a component was mounted inside the Shadow DOM, we'd detect this wrapping element as a valid 3rd-party element.

This PR fixes this my detecting if the component is mounted inside the shadow DOM, and if so, looking for the corresponding host element instead of the hidden node element we normally use.

Fixes #2856

Copy link

vercel bot commented Dec 5, 2023

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

Name Status Preview Comments Updated (UTC)
headlessui-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 5, 2023 4:15pm
headlessui-vue ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 5, 2023 4:15pm

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: cannot close by clicking out-side in a shadow-root
1 participant