Skip to content

Commit

Permalink
Ignore DOM state when hiding popovers if needed
Browse files Browse the repository at this point in the history
Fixes whatwg#9161
Fixes whatwg#9367
Makes obsolete whatwg/dom#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.
  • Loading branch information
josepharhar committed Jun 26, 2023
1 parent 8430871 commit f60c3a0
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -82409,9 +82409,11 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
<li><p>If <var>localName</var> is not <code data-x="attr-popover">popover</code>, then
return.</p></li>

<li><p>Let <var>fireEvents</var> be false if <var>value</var> is null, otherwise true.</p></li>

<li><p>If <var>oldValue</var> and <var>value</var> are in different <span
data-x="attr-popover">states</span>, then run the <span>hide popover algorithm</span> given
<var>element</var>, true, true, and false.</p></li>
<var>element</var>, true, <var>fireEvents</var>, and false.</p></li>
</ol>

<dl class="domintro">
Expand Down Expand Up @@ -82613,8 +82615,12 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
boolean <var>fireEvents</var>, and a boolean <var>throwExceptions</var>:</p>

<ol>
<li><p>If the result of running <span>check popover validity</span> given <var>element</var>,
true, <var>throwExceptions</var>, and null is false, then return.</p></li>
<li><p>If <var>fireEvents</var> is true and the result of running <span>check popover
validity</span> given <var>element</var>, true, <var>throwExceptions</var>, and null is false,
then return.</p></li>

<li><p>If <var>fireEvents</var> is false and <var>element</var>'s <span>popover visibility
state</span> is <span data-x="popover-hidden-state">hidden</span>, then return.</p></li>

<li><p>Let <var>document</var> be <var>element</var>'s <span>node document</span>.</p></li>

Expand Down Expand Up @@ -82643,15 +82649,19 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
<var>element</var>, <var>focusPreviousElement</var>, and <var>fireEvents</var>.</p></li>

<li>
<p>If the result of running <span>check popover validity</span> given <var>element</var>,
true, and <var>throwExceptions</var> is false, then run <var>cleanupHidingFlag</var> and
return.</p>
<p>If <var>fireEvents</var> is true and the result of running <span>check popover
validity</span> given <var>element</var>, true, and <var>throwExceptions</var> is false, then
run <var>cleanupHidingFlag</var> and return.</p>

<p class="note"><span>Check popover validity</span> is called again because running <span
data-x="hide-all-popovers-until">hide all popovers until</span> could have disconnected
<var>element</var> or changed its <code data-x="attr-popover">popover</code> attribute.</p>
</li>

<li><p>If <var>fireEvents</var> is false and <var>element</var>'s <span>popover visibility
state</span> is <span data-x="popover-hidden-state">hidden</span>, then run
<var>cleanupHidingFlag</var> and return.</p></li>

<li><p>If the last item in <var>document</var>'s <span>auto popover list</span> is
<var>element</var>, then <span>break</span>.</p></li>
</ol>
Expand Down

0 comments on commit f60c3a0

Please sign in to comment.