diff --git a/web/modals/modal.react.js b/web/modals/modal.react.js --- a/web/modals/modal.react.js +++ b/web/modals/modal.react.js @@ -31,10 +31,15 @@ withCloseButton = true, } = props; const overlayRef = React.useRef(); + const isBackgroundClick = React.useRef(null); - const onBackgroundClick = React.useCallback( + const onBackgroundMouseDown = React.useCallback(event => { + isBackgroundClick.current = event.target === overlayRef.current; + }, []); + + const onBackgroundMouseUp = React.useCallback( event => { - if (event.target === overlayRef.current) { + if (event.target === overlayRef.current && isBackgroundClick.current) { onClose(); } }, @@ -87,7 +92,8 @@