Skip to content

Commit 44b90ef

Browse files
authored
Fix interact outside false positive (#3935)
Clean up interact outside pointerDown on all pointerUps
1 parent 440f309 commit 44b90ef

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/@react-aria/interactions/src/useInteractOutside.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ export function useInteractOutside(props: InteractOutsideProps) {
5959
if (typeof PointerEvent !== 'undefined') {
6060
let onPointerUp = (e) => {
6161
if (state.isPointerDown && state.onInteractOutside && isValidEvent(e, ref)) {
62-
state.isPointerDown = false;
6362
state.onInteractOutside(e);
6463
}
64+
state.isPointerDown = false;
6565
};
6666

6767
// changing these to capture phase fixed combobox
@@ -77,17 +77,17 @@ export function useInteractOutside(props: InteractOutsideProps) {
7777
if (state.ignoreEmulatedMouseEvents) {
7878
state.ignoreEmulatedMouseEvents = false;
7979
} else if (state.isPointerDown && state.onInteractOutside && isValidEvent(e, ref)) {
80-
state.isPointerDown = false;
8180
state.onInteractOutside(e);
8281
}
82+
state.isPointerDown = false;
8383
};
8484

8585
let onTouchEnd = (e) => {
8686
state.ignoreEmulatedMouseEvents = true;
8787
if (state.onInteractOutside && state.isPointerDown && isValidEvent(e, ref)) {
88-
state.isPointerDown = false;
8988
state.onInteractOutside(e);
9089
}
90+
state.isPointerDown = false;
9191
};
9292

9393
document.addEventListener('mousedown', onPointerDown, true);

0 commit comments

Comments
 (0)