Skip to content

Commit

Permalink
feat: reafctor mouse event for web
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaCG committed Sep 18, 2023
1 parent 2e9b118 commit 2e8e554
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/utils/useOutsideClick/useOutsideClick.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ export const useOutsideClick: UseOutsideClickType = ({ref, handler}) => {
}
};

window.addEventListener('click', callback, {capture: true});
window.addEventListener('mousedown', callback, {capture: true});
window.addEventListener('touchend', callback, {capture: true});

return () => {
window.removeEventListener('click', callback, {capture: true});
window.removeEventListener('mousedown', callback, {capture: true});
window.removeEventListener('touchend', callback, {capture: true});
};
}, [handler, ref]);
Expand Down

0 comments on commit 2e8e554

Please sign in to comment.