Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "check and possibly close popover stack" algorithm #9048

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -1828,6 +1828,10 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li><p>If <var>removedNode</var>'s <code data-x="attr-popover">popover</code> attribute is not in
the <span data-x="attr-popover-none-state">no popover state</span>, then run the <span>hide
popover algorithm</span> given <var>removedNode</var>, false, false, and false.</p></li>

<li><p>If <var>removedNode</var> is a <span data-x="concept-button">button</span>, then run
<span>check and possibly close popover stack</span> given <var>removedNode</var>'s <span>node
document</span>.</p></li>
</ol>

<p>A <dfn id="insert-an-element-into-a-document" data-x="node is inserted into a document"
Expand Down Expand Up @@ -47024,6 +47028,9 @@ interface <dfn interface>HTMLInputElement</dfn> : <span>HTMLElement</span> {
element's <span data-x="concept-textarea/input-cursor">text entry cursor position</span> to the
beginning of the text control, and <span data-x="set the selection direction">set its selection
direction</span> to "<code data-x="">none</code>".</p></li>

<li><p>Run <span>check and possibly close popover stack</span> given the element's <span>node
document</span>.</p></li>
josepharhar marked this conversation as resolved.
Show resolved Hide resolved
</ol>

</div>
Expand Down Expand Up @@ -81861,6 +81868,11 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
<ol>
<li><p>If <var>namespace</var> is not null, then return.</p></li>

<li><p>If <var>localName</var> is <code data-x="attr-fe-disabled">disabled</code>, <code
data-x="attr-fae-form">form</code>, or <code data-x="attr-popovertarget">popovertarget</code>,
then run <span>check and possibly close popover stack</span> given <var>element</var>'s
<span>node document</span>.</p></li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is correct for form and possibly popovertarget. This algorithm runs whenever the value is set, even when it's set to the same value. Presumably when it's set to the same value we don't want to invalidate.


<li><p>If <var>localName</var> is not <code data-x="attr-popover">popover</code>, then
return.</p></li>

Expand Down Expand Up @@ -82411,6 +82423,42 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
<li><p>Return true.</p></li>
</ol>

<p>To <dfn>check and possibly close popover stack</dfn> for a <code>Document</code>
<var>document</var>:</p>

<ol>
<li><p>Let <var>stack</var> be <var>document</var>'s <span>auto popover list</span>.</p></li>

<li><p>Let <var>index</var> <var>stack</var>'s <span data-x="list size">size</span> - 1.</p></li>

<li>
<p><span>While</span> <var>index</var> is greater than 0:</p>

<ol>
<li>
<p>If the result of running <span>topmost popover ancestor</span> given
<var>stack</var>[<var>index</var>] is not <var>stack</var>[<var>index</var> - 1], then:</p>

<ol>
<li><p>Run <span>hide all popovers</span> given <var>document</var>.</p></li>

<li><p>Return.</p></li>
</ol>
</li>

<li><p>Set <var>index</var> to <var>index</var> - 1.</p></li>
</ol>
</li>
</ol>

<div class="note">
<p><span>Check and possibly close popover stack</span> is used to close multiple popovers which
are only open due to their ancestral relationship to each other in the case where that ancestral
relationship has been broken. <span>Show popover</span> also closes popovers which don't meet
this ancestral relationship by calling <span data-x="hide-all-popovers-until">hide all popovers
until</span>.</p>
</div>

<h4>The popover target attributes</h4>

<p><span data-x="concept-button">Buttons</span> may have the following content attributes:</p>
Expand Down