From aed22ef66d3bb90854799cc8dcb7e3da73753ef8 Mon Sep 17 00:00:00 2001 From: Raphael Melloni Date: Tue, 27 Sep 2022 12:24:54 +0200 Subject: [PATCH] check inside shadow dom for use-outside-click --- packages/@headlessui-react/src/hooks/use-outside-click.ts | 2 +- packages/@headlessui-vue/src/hooks/use-outside-click.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@headlessui-react/src/hooks/use-outside-click.ts b/packages/@headlessui-react/src/hooks/use-outside-click.ts index d877d963c1..7f7360393b 100644 --- a/packages/@headlessui-react/src/hooks/use-outside-click.ts +++ b/packages/@headlessui-react/src/hooks/use-outside-click.ts @@ -96,7 +96,7 @@ export function useOutsideClick( 'mousedown', (event) => { if (enabledRef.current) { - initialClickTarget.current = event.target + initialClickTarget.current = event.composedPath?.()?.[0] || event.target } }, true diff --git a/packages/@headlessui-vue/src/hooks/use-outside-click.ts b/packages/@headlessui-vue/src/hooks/use-outside-click.ts index 5083ccf4a9..b89fead59a 100644 --- a/packages/@headlessui-vue/src/hooks/use-outside-click.ts +++ b/packages/@headlessui-vue/src/hooks/use-outside-click.ts @@ -82,7 +82,7 @@ export function useOutsideClick( 'mousedown', (event) => { if (enabled.value) { - initialClickTarget.value = event.target + initialClickTarget.value = event.composedPath?.()?.[0] || event.target } }, true