File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
packages/design-system/src/components/primitives Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -439,6 +439,11 @@ const requestPointerLock = (
439
439
} ;
440
440
} ) ;
441
441
442
+ let isDisposed = false ;
443
+ disposeOnCleanup ( ( ) => ( ) => {
444
+ isDisposed = true ;
445
+ } ) ;
446
+
442
447
const isSafari = / ^ ( (? ! c h r o m e | a n d r o i d ) .) * s a f a r i / i. test ( navigator . userAgent ) ;
443
448
444
449
// Safari supports pointer lock well, but the issue lies with the pointer lock banner.
@@ -450,6 +455,14 @@ const requestPointerLock = (
450
455
requestPointerLockSafe ( targetNode )
451
456
. then ( ( ) => {
452
457
state . pointerCaptureRequested = false ;
458
+
459
+ if ( isDisposed ) {
460
+ if ( targetNode . ownerDocument . pointerLockElement === targetNode ) {
461
+ targetNode . ownerDocument . exitPointerLock ( ) ;
462
+ }
463
+ return ;
464
+ }
465
+
453
466
const cursorNode =
454
467
( targetNode . ownerDocument . querySelector (
455
468
"#numeric-guesture-control-cursor"
You can’t perform that action at this time.
0 commit comments