out side click fix

This commit is contained in:
hamid zarghami
2026-07-25 12:52:49 +03:30
parent b2f9166c22
commit 9413cf03c9
@@ -61,8 +61,10 @@ const TaskDetailPopoverPanel: FC<Props> = ({ anchorRef, children, className, wid
onClose(); onClose();
}; };
document.addEventListener("pointerdown", handlePointerDown); // Capture: DefaulModal stops pointerdown propagation on bubble, so outside-click
return () => document.removeEventListener("pointerdown", handlePointerDown); // would never reach a document bubble listener while the modal is open.
document.addEventListener("pointerdown", handlePointerDown, true);
return () => document.removeEventListener("pointerdown", handlePointerDown, true);
}, [anchorRef, onClose]); }, [anchorRef, onClose]);
if (!position) return null; if (!position) return null;