From 83ca0c297457fa68aa1e6d7e181694abc3c0f4dc Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Tue, 11 Jun 2024 14:23:39 -0400 Subject: [PATCH] fix: ignore `touchstart` events for closing modal popups --- src/Modal/ModalPopup.jsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Modal/ModalPopup.jsx b/src/Modal/ModalPopup.jsx index 52bc3adb04..e6c36fd45e 100644 --- a/src/Modal/ModalPopup.jsx +++ b/src/Modal/ModalPopup.jsx @@ -34,6 +34,14 @@ function ModalPopup({ }, ]; + const handleOnClickOutside = (e) => { + if (e.type === 'touchstart') { + return; + } + + onClose(); + }; + return ( @@ -47,7 +55,7 @@ function ModalPopup({ scrollLock={false} enabled={isOpen} onEscapeKey={onClose} - onClickOutside={onClose} + onClickOutside={handleOnClickOutside} > {isOpen && (