diff --git a/ui/common/src/dialog.ts b/ui/common/src/dialog.ts index e03422c46c170..6889cdcd1ab61 100644 --- a/ui/common/src/dialog.ts +++ b/ui/common/src/dialog.ts @@ -246,12 +246,11 @@ class DialogWrapper implements Dialog { const justThen = Date.now(); const cancelOnInterval = (e: PointerEvent) => { if (Date.now() - justThen < 200) return; - const r = dialog.getBoundingClientRect(); - if ( - dialog.isConnected && - (e.clientX < r.left || e.clientX > r.right || e.clientY < r.top || e.clientY > r.bottom) - ) - this.close('cancel'); + if (dialog.isConnected) { + const r = dialog.getBoundingClientRect(); + if (e.clientX < r.left || e.clientX > r.right || e.clientY < r.top || e.clientY > r.bottom) + this.close('cancel'); + } }; this.observer.observe(document.body, { childList: true, subtree: true }); view.parentElement?.style.setProperty('---viewport-height', `${window.innerHeight}px`);