Skip to content

Commit

Permalink
fix: set capture on event listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
anastasialanz committed Sep 30, 2024
1 parent 56107e7 commit 469811e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 4 additions & 4 deletions packages/react/src/components/ClickOutsideListener/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ function ClickOutsideListener(

useEffect(() => {
typeof mouseEvent === 'string' &&
document.addEventListener(mouseEvent, handleEvent);
document.addEventListener(mouseEvent, handleEvent, true);
typeof touchEvent === 'string' &&
document.addEventListener(touchEvent, handleEvent);
document.addEventListener(touchEvent, handleEvent, true);

return () => {
typeof mouseEvent === 'string' &&
document.removeEventListener(mouseEvent, handleEvent);
document.removeEventListener(mouseEvent, handleEvent, true);
typeof touchEvent === 'string' &&
document.removeEventListener(touchEvent, handleEvent);
document.removeEventListener(touchEvent, handleEvent, true);
};
}, [mouseEvent, touchEvent]);

Expand Down
2 changes: 0 additions & 2 deletions packages/react/src/components/Popover/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,6 @@ const Popover = forwardRef<HTMLDivElement, PopoverProps>(
}, [targetElement, id, show]);

const handleClickOutside = () => {
// console.log("should the initial click be calling handleClickOutside?");
// console.log('handleClickOutside', show);
if (show) {
handleClosePopover();
}
Expand Down

0 comments on commit 469811e

Please sign in to comment.