Skip to content

Commit

Permalink
Define auto popover list in terms of the top layer
Browse files Browse the repository at this point in the history
This solves an issue with elements being unconditionally added to this list and makes it clearer that the steps between it being added here and the top layer didn't mean anything.

This also makes hide popover use check popover validity more to rely on the shared infrastructure.

Fixes #8941 and fixes #8964.
  • Loading branch information
annevk authored Mar 3, 2023
1 parent 2556488 commit 1257236
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -81787,8 +81787,10 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
data-x="popover-showing-state">showing</dfn></p></li>
</ul>

<p>The <code>Document</code> has an <dfn>auto popover list</dfn>, which is a <span>list</span>,
initially empty.</p>
<p>The <code>Document</code> has an <dfn>auto popover list</dfn>, which is a <span>list</span> of
all the elements in the <code>Document</code>'s <span>top layer</span> whose <code
data-x="attr-popover">popover</code> attribute is in the <span
data-x="attr-popover-auto-state">auto state</span>, in the same order.</p>

<p>The <code>Document</code> has a <dfn>popover pointerdown target</dfn>, which is an <span
data-x="HTML elements">HTML element</span> or null, initially null.</p>
Expand Down Expand Up @@ -81923,8 +81925,6 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
the first popover in a stack.</p>
</li>

<li><p>Add <var>element</var> to <var>document</var>'s <span>auto popover list</span>.</p></li>

<li><p>Set <var>element</var>'s <span>previously focused element</span> to null.</p></li>

<li><p>Let <var>originallyFocusedElement</var> be <var>document</var>'s <span>focused area of the
Expand Down Expand Up @@ -82012,21 +82012,17 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
<var>element</var>, <var>focusPreviousElement</var>, and <var>fireEvents</var>.</p></li>

<li>
<p>If <var>element</var> is not in <var>document</var>'s <span>auto popover list</span>:</p>

<ol>
<li><p>If <var>throwExceptions</var> is true, then throw an
<span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>.</p></li>
<p>If the result of running <span>check popover validity</span> given <var>element</var>,
true, and <var>throwExceptions</var> is false, then return.</p>

<li><p>Otherwise, return.</p></li>
</ol>
<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><span>Assert</span>: The last item in <var>document</var>'s <span>auto popover
<li><p><span>Assert</span>: the last item in <var>document</var>'s <span>auto popover
list</span> is <var>element</var>.</p></li>

<li><p><span data-x="list remove">Remove</span> <var>element</var> from <var>document</var>'s
<span>auto popover list</span>.</p></li>
</ol>
</li>

Expand All @@ -82047,8 +82043,8 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
true, and <var>throwExceptions</var> is false, then return.</p>

<p class="note"><span>Check popover validity</span> is called again because firing the <code
data-x="event-beforetoggle">beforetoggle</code> event could have disconnected this element or
changed its <code data-x="attr-popover">popover</code> attribute.</p>
data-x="event-beforetoggle">beforetoggle</code> event could have disconnected
<var>element</var> or changed its <code data-x="attr-popover">popover</code> attribute.</p>
</li>
</ol>
</li>
Expand Down Expand Up @@ -82169,7 +82165,7 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
elements">HTML element</span> or null.</p>

<div class="note">
<p>The <span>topmost popover ancestor</span> algorithm will return the topmost (highest in the
<p>The <span>topmost popover ancestor</span> algorithm will return the topmost (latest in the
<span>auto popover list</span>) ancestor popover for the provided popover. Popovers can be
related to each other in several ways, creating a tree of popovers. There are two paths through
which one popover (call it the "child" popover) can have an ancestor popover (call it the
Expand All @@ -82185,7 +82181,7 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
the "parent". The invoker must be in a popover and reference an open popover.</p></li>
</ol>

<p>In each of the relationships formed above, the parent popover must be strictly lower in the
<p>In each of the relationships formed above, the parent popover must be strictly earlier in the
<span>auto popover list</span> than the child popover, or it does not form a valid ancestral
relationship. This eliminates non-showing popovers and self-pointers (e.g. a popover with an
anchor attribute that points back to the same popover), and it allows for the construction of a
Expand Down

0 comments on commit 1257236

Please sign in to comment.