diff --git a/packages/hooks/src/useClickAway/index.ts b/packages/hooks/src/useClickAway/index.ts index 92f1a7ba54..b98885f409 100644 --- a/packages/hooks/src/useClickAway/index.ts +++ b/packages/hooks/src/useClickAway/index.ts @@ -15,12 +15,12 @@ export default function useClickAway( useEffectWithTarget( () => { - const handler = (event: any) => { + const handler = (event: T) => { const targets = Array.isArray(target) ? target : [target]; if ( targets.some((item) => { const targetElement = getTargetElement(item); - return !targetElement || targetElement.contains(event.target); + return !targetElement || event.composedPath().includes(targetElement); }) ) { return;