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

Add support for ReactShadowRoot #173

Merged
merged 1 commit into from
Feb 9, 2022
Merged

Add support for ReactShadowRoot #173

merged 1 commit into from
Feb 9, 2022

Conversation

fregante
Copy link
Contributor

@fregante fregante commented Feb 9, 2022

Before

kbar.doesn.t.close.mov

After

Screen.Recording.1.mov

@vercel
Copy link

vercel bot commented Feb 9, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/timc/kbar/48xqyH9kRJyMhrhwBP2HZV4tNyQf
✅ Preview: https://kbar-git-fork-fregante-patch-1-timc.vercel.app

dom.current?.contains(event.target) ||
// Add support for ReactShadowRoot
// @ts-expect-error wrong types, the `host` property exists https://stackoverflow.com/a/25340456
event.target === dom.current?.getRootNode().host
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Events inside the shadow DOM do bubble up to window, however their target will be the host element, not the actual element, because the shadow DOM incapsulate everything inside it.

@fregante fregante marked this pull request as ready for review February 9, 2022 09:21
@timc1
Copy link
Owner

timc1 commented Feb 9, 2022

Right now, thank you @fregante!

@timc1 timc1 self-requested a review February 9, 2022 17:50
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.

useOuterClick doesn't work in shadow DOM
2 participants