Bug 1835464 - Check dialog is modal flag instead of open attribute in 'check popover validity' algorithm. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D181089
This commit is contained in:
Ziran Sun
2023-06-20 08:49:32 +00:00
parent 591fe42773
commit 57898e14ae
3 changed files with 5 additions and 20 deletions

View File

@@ -3276,9 +3276,11 @@ bool nsGenericHTMLElement::CheckPopoverValidity(
return false;
}
if (IsHTMLElement(nsGkAtoms::dialog) && HasAttr(nsGkAtoms::open)) {
aRv.ThrowInvalidStateError("Element is an open <dialog> element");
return false;
if (auto* dialog = HTMLDialogElement::FromNode(this)) {
if (dialog->IsInTopLayer()) {
aRv.ThrowInvalidStateError("Element is a modal <dialog> element");
return false;
}
}
if (State().HasState(ElementState::FULLSCREEN)) {