Skip to content

Commit

Permalink
fix: ignore touchstart events for closing modal popups
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-smith-tcril committed Jun 11, 2024
1 parent d4b08db commit 83ca0c2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Modal/ModalPopup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ function ModalPopup({
},
];

const handleOnClickOutside = (e) => {
if (e.type === 'touchstart') {
return;

Check warning on line 39 in src/Modal/ModalPopup.jsx

View check run for this annotation

Codecov / codecov/patch

src/Modal/ModalPopup.jsx#L39

Added line #L39 was not covered by tests
}

onClose();

Check warning on line 42 in src/Modal/ModalPopup.jsx

View check run for this annotation

Codecov / codecov/patch

src/Modal/ModalPopup.jsx#L42

Added line #L42 was not covered by tests
};

return (
<ModalContextProvider onClose={onClose} isOpen={isOpen} isBlocking={isBlocking}>
<RootComponent>
Expand All @@ -47,7 +55,7 @@ function ModalPopup({
scrollLock={false}
enabled={isOpen}
onEscapeKey={onClose}
onClickOutside={onClose}
onClickOutside={handleOnClickOutside}
>
{isOpen && (
<div className="pgn__modal-popup__tooltip">
Expand Down

0 comments on commit 83ca0c2

Please sign in to comment.