Skip to content

Commit

Permalink
Update index.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
iahu committed Aug 30, 2024
1 parent 1a764b1 commit 271112e
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export function generateTrigger(
const originChildProps = child?.props || {};
const cloneProps: typeof originChildProps = {};

const inContainer = (container: Element, target: Element) => {
const inContainer = (target: Element, container: Element) => {
return (
target === container ||
container.contains(target) ||
Expand All @@ -283,13 +283,12 @@ export function generateTrigger(

const inPopupOrChild = useEvent((ele: EventTarget) => {
const childDOM = targetEle;
const eleInContainer = inContainer.bind(null, ele as Element);

return (
inContainer(childDOM, ele as Element) ||
inContainer(popupEle, ele as Element) ||
Object.values(subPopupElements.current).some((subPopupEle) =>
inContainer(subPopupEle, ele as Element),
)
eleInContainer(childDOM) ||
eleInContainer(popupEle) ||
Object.values(subPopupElements.current).some(eleInContainer)
);
});

Expand Down

0 comments on commit 271112e

Please sign in to comment.