From aaf0fa6f4070015b9b8c0dc5ac043db494139673 Mon Sep 17 00:00:00 2001
From: Tim Nguyen
Date: Sat, 27 May 2023 00:52:04 -0700
Subject: [PATCH] Check dialog is modal flag instead of open attribute in
'check popover validity' algorithm
The following case currently does not fail:
```
dialog.showModal();
dialog.open = false;
dialog.showPopover();
```
even though it is a top layer conflict:
1. `showModal` pushes to the top layer
2. `.open = false` then hides the dialog, while keeping it in top layer
3. `showPopover` pushes to the top layer again
The check for the open attribute is supposed to prevent top layer conflicts, since those conflicts
can leave the element in a broken state, notably after hiding. For instance, the previous sequence
of actions followed by `dialog.hidePopover()` will leave the `is modal` flag despite the dialog
being completely removed from the top layer.
Also only remove from top layer in `HTMLDialogElement.prototype.close()` when the is modal flag is
true to prevent that method from removing popovers from the top layer.
Fixes #9335
---
source | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/source b/source
index 7d1c237630b..e23f5c91ca5 100644
--- a/source
+++ b/source
@@ -60289,13 +60289,13 @@ interface HTMLDialogElement : HTMLElement {
Remove subject's open
attribute.
+ If the is modal flag of subject is true, then remove it from its Document
's top layer.
+
Set the is modal flag of subject to false.
If result is not null, then set the returnValue
attribute to result.
-
- If subject is in its Document
's top layer, then remove it.
+ data-x="dom-dialog-returnValue">returnValue attribute to result.
If subject's previously focused element is not null, then:
@@ -82793,8 +82793,8 @@ dictionary DragEventInit : MouseEventInit {
expectedDocument is not null and element's node
document is not expectedDocument
- element is a dialog
element and has an open
attribute
+ element is a dialog
element and its is modal flag
+ is set to true.
element's fullscreen flag is set