From 22ba6b68d63d3c34ed490d77146ccaa1786a0d5f Mon Sep 17 00:00:00 2001 From: Joey Arhar Date: Mon, 12 Feb 2024 08:42:17 +0000 Subject: [PATCH] Bug 1878797 [wpt PR 44408] - Close the dialog element when the open attribute is removed, a=testonly Automatic update from web-platform-tests Close the dialog element when the open attribute is removed This patch adds HTMLDialogElement::ParseAttribute which runs HTMLDialogElement::close when the open attribute is removed to prevent a bad state where the dialog is modal but hidden and inerting the rest of the document. Spec discussion is happening here: https://github.com/whatwg/html/issues/5802 Change-Id: Ib90736ced952d7aeadc791c6863c3ac2a55deb62 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5269905 Reviewed-by: David Baron Commit-Queue: Joey Arhar Cr-Commit-Position: refs/heads/main@{#1258629} -- wpt-commits: c0538d5500ef425b051f7dcb37772af5025324d0 wpt-pr: 44408 --- .../dialog-close-via-attribute.html | 59 +++++++++++++++++++ .../the-dialog-element/dialog-showModal.html | 4 +- 2 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-close-via-attribute.html diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-close-via-attribute.html b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-close-via-attribute.html new file mode 100644 index 0000000000000..5c2e70f87a610 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-close-via-attribute.html @@ -0,0 +1,59 @@ + + + + + + + + + +hello world + + diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-showModal.html b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-showModal.html index 5edff18614225..47612e759eaa4 100644 --- a/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-showModal.html +++ b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/dialog-showModal.html @@ -161,11 +161,11 @@ assert_equals(topElement(), d11); // Removing the open attribute and running through the showModal() algorithm - // again should not promote d10 to the top. + // again should promote d10 to the top. d10.removeAttribute("open"); assert_equals(topElement(), d11); d10.showModal(); - assert_equals(topElement(), d11); + assert_equals(topElement(), d10); // Closing d11 with close() should cause d10 to be the topmost element. d11.close();