Page MenuHomePhabricator

D5315.id17539.diff
No OneTemporary

D5315.id17539.diff

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,20 @@
withCloseButton = true,
} = props;
const overlayRef = React.useRef();
+ const firstClickRef = React.useRef(null);
- const onBackgroundClick = React.useCallback(
+ const onBackgroundMouseDown = React.useCallback(event => {
+ console.log(event.type, event.target);
+ firstClickRef.current = event.target;
+ }, []);
+
+ const onBackgroundMouseUp = React.useCallback(
event => {
- if (event.target === overlayRef.current) {
+ console.log(event.type, event.target);
+ if (
+ event.target === overlayRef.current &&
+ firstClickRef.current === overlayRef.current
+ ) {
onClose();
}
},
@@ -87,7 +97,8 @@
<div
className={css.modalOverlay}
ref={overlayRef}
- onClick={onBackgroundClick}
+ onMouseDown={onBackgroundMouseDown}
+ onMouseUp={onBackgroundMouseUp}
tabIndex={0}
onKeyDown={onKeyDown}
>

File Metadata

Mime Type
text/plain
Expires
Thu, Sep 19, 8:17 AM (2 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2136146
Default Alt Text
D5315.id17539.diff (1 KB)

Event Timeline