From f60c3a05a7513041e4075cce82c376d1f21da7ca Mon Sep 17 00:00:00 2001
From: Joey Arhar
Date: Thu, 22 Jun 2023 21:23:43 -0700
Subject: [PATCH] Ignore DOM state when hiding popovers if needed
Fixes https://github.com/whatwg/html/issues/9161
Fixes https://github.com/whatwg/html/issues/9367
Makes obsolete https://github.com/whatwg/dom/pull/1185
This PR prevents the hide popover algorithm from returning early when
the popover attribute is removed or when the element with the popover
attribute is removed from the document.
The fireEvents parameter is used as an indicator that either the element
is being removed or that the attribute is being removed, and when it is
false, the calls to check popover validity are replaced with a check to
simply see if the popover is already hidden.
This patch also makes removal of the popover attribute stop firing
events in order to signal to the hide popover algorithm that checks for
the popover attribute should be ignored.
---
source | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/source b/source
index be9f621d529..1a55b52687c 100644
--- a/source
+++ b/source
@@ -82409,9 +82409,11 @@ dictionary DragEventInit : MouseEventInit {
If localName is not popover
, then
return.
+ Let fireEvents be false if value is null, otherwise true.
+
If oldValue and value are in different states, then run the hide popover algorithm given
- element, true, true, and false.
+ element, true, fireEvents, and false.
@@ -82613,8 +82615,12 @@ dictionary DragEventInit : MouseEventInit {
boolean fireEvents, and a boolean throwExceptions:
- If the result of running check popover validity given element,
- true, throwExceptions, and null is false, then return.
+ If fireEvents is true and the result of running check popover
+ validity given element, true, throwExceptions, and null is false,
+ then return.
+
+ If fireEvents is false and element's popover visibility
+ state is hidden, then return.
Let document be element's node document.
@@ -82643,15 +82649,19 @@ dictionary DragEventInit : MouseEventInit {
element, focusPreviousElement, and fireEvents.
-
-
If the result of running check popover validity given element,
- true, and throwExceptions is false, then run cleanupHidingFlag and
- return.
+ If fireEvents is true and the result of running check popover
+ validity given element, true, and throwExceptions is false, then
+ run cleanupHidingFlag and return.
Check popover validity is called again because running hide all popovers until could have disconnected
element or changed its popover
attribute.
+ If fireEvents is false and element's popover visibility
+ state is hidden, then run
+ cleanupHidingFlag and return.
+
If the last item in document's auto popover list is
element, then break.