Skip to content

Commit

Permalink
When deciding whether to call close, only use the rectangle of a di…
Browse files Browse the repository at this point in the history
…alog if it is connected to the DOM.
  • Loading branch information
johndoknjas committed Dec 19, 2024
1 parent 099d2e1 commit a3a0288
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ui/common/src/dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,10 @@ class DialogWrapper implements Dialog {
const cancelOnInterval = (e: PointerEvent) => {
if (Date.now() - justThen < 200) return;
const r = dialog.getBoundingClientRect();
if (e.clientX < r.left || e.clientX > r.right || e.clientY < r.top || e.clientY > r.bottom)
if (
dialog.isConnected &&
(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 });
Expand Down

0 comments on commit a3a0288

Please sign in to comment.