8000 fix(useDismiss): bail out of blur to mark inside React tree if floati… · psy-repos-typescript/floating-ui@df494e7 · GitHub
[go: up one dir, main page]

Skip to content

Commit df494e7

Browse files
authored
fix(useDismiss): bail out of blur to mark inside React tree if floating tree exists (floating-ui#3331)
1 parent 54b57a3 commit df494e7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.changeset/mighty-chairs-invite.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@floating-ui/react": patch
3+
---
4+
5+
fix(useDismiss): bail out of blur to mark inside react tree if floating tree exists

packages/react/src/hooks/useDismiss.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,14 +523,15 @@ export function useDismiss(
523523
dataRef.current.insideReactTree = true;
524524
},
525525
onBlurCapture() {
526+
if (tree) return;
526527
clearTimeoutIfSet(blurTimeoutRef);
527528
dataRef.current.insideReactTree = true;
528529
blurTimeoutRef.current = window.setTimeout(() => {
529530
dataRef.current.insideReactTree = false;
530531
});
531532
},
532533
}),
533-
[closeOnEscapeKeyDown, outsidePressEvent, dataRef],
534+
[closeOnEscapeKeyDown, outsidePressEvent, dataRef, tree],
534535
);
535536

536537
return React.useMemo(

0 commit comments

Comments
 (0)
0