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