Skip to content

Commit

Permalink
Add "hide all popovers" algorithm
Browse files Browse the repository at this point in the history
This was requested for cross referencing instead of "hide all popovers
until" here:
whatwg/fullscreen#204 (comment)

This patch also fixes a bug where a null endpoint is passed to hide all
popovers until, but hide all popovers until assumes endpoint is not null
by looking for endpoint's node document. The bug is fixed by adding a
required document parameter to hide all popovers until.
  • Loading branch information
josepharhar committed Feb 14, 2023
1 parent 69998ed commit ea851d1
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -59600,8 +59600,8 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
and a boolean <var>isModal</var>, are as follows:</p>

<ol>
<li><p>Run <span data-x="hide-all-popovers-until">hide all popovers until</span> given null,
false, and false.</p></li>
<li><p>Run <span>hide all popovers</span> given <var>subject</var>'s <span>node
document</span>.</p></li>

<li><p>Let <var>control</var> be null.</p></li>

Expand Down Expand Up @@ -81438,7 +81438,8 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
ancestor</span> algorithm given <var>element</var>.</p></li>

<li><p>Run <span data-x="hide-all-popovers-until">hide all popovers until</span> given
<var>ancestor</var>, false, and false.</p></li>
<var>ancestor</var>'s <span>node document</span>, <var>ancestor</var>, false, and
false.</p></li>

<li>
<p>If <var>originalType</var> is not equal to the value of <var>element</var>'s <code
Expand Down Expand Up @@ -81564,8 +81565,8 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {

<ol>
<li><p>Run <span data-x="hide-all-popovers-until">hide all popovers until</span> given
<var>element</var>, <var>focusPreviousElement</var>, and
<var>dontFireEvents</var>.</p></li>
<var>element</var>'s <span>node document</span>, <var>element</var>,
<var>focusPreviousElement</var>, and <var>dontFireEvents</var>.</p></li>

<li>
<p>If <var>element</var> is not in <var>document</var>'s <span>auto popover list</span>:</p>
Expand Down Expand Up @@ -81655,13 +81656,12 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
given <span>this</span> and true.</p></li>
</ol>

<p>To <dfn data-x="hide-all-popovers-until">hide all popovers until</dfn>, given an <span
data-x="HTML elements">HTML element</span> <var>endpoint</var>, a boolean
<var>focusPreviousElement</var>, and a boolean <var>dontFireEvents</var>:</p>
<p>To <dfn data-x="hide-all-popovers-until">hide all popovers until</dfn>, given a
<code>Document</code> <var>document</var>, an <span data-x="HTML elements">HTML element</span> or
null <var>endpoint</var>, a boolean <var>focusPreviousElement</var>, and a boolean
<var>dontFireEvents</var>:</p>

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

<li>
<p>Let <var>closeAllOpenPopovers</var> be an algorithm which performs the following steps:</p>

Expand Down Expand Up @@ -81723,6 +81723,10 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
happens. For example, during light-dismiss of a popover, this algorithm ensures that we close only
the popovers that aren't related to the node clicked by the user.</p>

<p>To <dfn export>hide all popovers</dfn>, given a <code>Document</code> <var>document</var>, run
<span data-x="hide-all-popovers-until">hide all popovers until</span> given <var>document</var>,
null, false, and false.</p>

<p>To find the <dfn>topmost popover ancestor</dfn>, given a <code>Node</code>
<var>newPopover</var>, perform the following steps. They return an <span data-x="HTML
elements">HTML element</span> or null.</p>
Expand Down Expand Up @@ -82121,7 +82125,8 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
<li><p>Set <var>document</var>'s <span>popover pointerdown target</span> to null.</p></li>

<li><p>If <var>sameTarget</var> is true, then run <span data-x="hide-all-popovers-until">hide
all popovers until</span> given <var>ancestor</var>, false, and false.</p></li>
all popovers until</span> given <var>ancestor</var>'s <span>node document</span>,
<var>ancestor</var>, false, and false.</p></li>
</ol>
</li>
</ol>
Expand Down

0 comments on commit ea851d1

Please sign in to comment.