Skip to content

Commit

Permalink
Fix outside click detection when component is mounted in the Shadow D…
Browse files Browse the repository at this point in the history
…OM in Vue
  • Loading branch information
thecrypticace committed Dec 5, 2023
1 parent 7b30e06 commit 6846231
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/@headlessui-vue/src/hooks/use-root-containers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export function useRootContainers({
if (!(container instanceof HTMLElement)) continue // Skip non-HTMLElements
if (container.id === 'headlessui-portal-root') continue // Skip the Headless UI portal root
if (container.contains(dom(mainTreeNodeRef))) continue // Skip if it is the main app
if (container.contains((dom(mainTreeNodeRef)?.getRootNode() as ShadowRoot)?.host)) continue // Skip if it is the main app (and the component is inside a shadow root)
if (containers.some((defaultContainer) => container.contains(defaultContainer))) continue // Skip if the current container is part of a container we've already seen (e.g.: default container / portal)

containers.push(container)
Expand Down

2 comments on commit 6846231

@vercel
Copy link

@vercel vercel bot commented on 6846231 Dec 5, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

headlessui-vue – ./packages/playground-vue

headlessui-vue-git-main-tailwindlabs.vercel.app
headlessui-vue.vercel.app
headlessui-vue-tailwindlabs.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 6846231 Dec 5, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

headlessui-react – ./packages/playground-react

headlessui-react-git-main-tailwindlabs.vercel.app
headlessui-react-tailwindlabs.vercel.app
headlessui-react.vercel.app

Please sign in to comment.