-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"check popover algorithm" check for open dialogs is weak #9335
Comments
Hmm, the behavior in Chromium is that (This is precisely why I really didn't want to add an |
This isn't the case per the spec right now, the modal dialog will be hidden (display: none), but still in the top layer. (WebKit caught this because this triggered an assertion) |
Boo. That's the case also in Chromium, but it is rendered I wonder if we shouldn't change the spec so that removing |
I think this might be an entirely separate discussion, because we'd want to figure out what
I think we do want to avoid top layer conflicts (e.g. having something that is opened in top layer for 2 different reasons), because it can leave the element in the broken state once you get to the point of removing it from the top layer. Also, it makes the stacking order unclear in the top layer if there are multiple elements. I'd personally be in favor in changing the check from checking for the "open attribute" to checking for the "modal state", since I think the original intent for the check is to prevent top layer conflicts. |
Yeah, I agree. Again, I wish we could get rid of
Given the above, I agree that it's probably good to change the check from |
That separate discussion is #5802, and would be great if people were willing to tackle it. |
…r 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. Fixes whatwg#9335
…r 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. Fixes whatwg#9335
I created #9344 |
@mfreed7 FWIW, a side-effect of my PR is that we can call |
…r 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 whatwg#9335
…r 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 whatwg#9335
…r 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. For `dialog.close()` to be symmetric & consistent with `dialog.show()`, we also stop throwing when `show()` is called on a dialog in the popover showing state. Fixes whatwg#9335
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 set to true 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. For dialog.close() to be symmetric & consistent with dialog.show(), we also stop throwing when show() is called on a dialog in the popover showing state. Tests: WebKit/WebKit#14454. Fixes #9335.
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 set to true 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. For dialog.close() to be symmetric & consistent with dialog.show(), we also stop throwing when show() is called on a dialog in the popover showing state. Tests: WebKit/WebKit#14454. Fixes whatwg#9335.
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 set to true 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. For dialog.close() to be symmetric & consistent with dialog.show(), we also stop throwing when show() is called on a dialog in the popover showing state. Tests: WebKit/WebKit#14454. Fixes whatwg#9335.
https://html.spec.whatwg.org/multipage/popover.html#check-popover-validity
This check doesn't cover this case (in terms of top layer conflicts):
Should we change this check to checking whether the dialog is in modal state instead?
cc @annevk @domenic @mfreed7 @josepharhar @emilio @cathiechen
The text was updated successfully, but these errors were encountered: