Skip to content

Commit

Permalink
Hide all popovers when beforetoggle shows a popover
Browse files Browse the repository at this point in the history
See http://crrev.com/c/5141430:

It was previously possible to hit some underspecified behavior with something like this:

<div popover id=p1>Popover 1
  <div popover id=p2>Popover 2</div>
</div>
<script>
  p1.showPopover();
  p1.addEventListener('beforetoggle',() => p2.showPopover());
  p1.hidePopover();
</script>

The problem is that "hide all popovers until" doesn't end up with the desired "until" popover on the top of the stack in this case. There is already a similar situation within the "hide all..." algorithm itself, but that only handles the case where a popover being hidden by "hide all..." has the beforetoggle listener. This is the same problem, but for the case that the "until" popover has that listener.
  • Loading branch information
josepharhar authored Feb 7, 2024
1 parent ae80157 commit e41f54e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -84611,6 +84611,10 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
</ol>
</li>

<li><p>Let <var>autoPopoverListContainsElement</var> be true if <var>document</var>'s
<span>showing auto popover list</span>'s last item is <var>element</var>, otherwise
false.</p></li>

<li><p>Set <var>element</var>'s <span>popover invoker</span> to null.</p></li>

<li>
Expand All @@ -84623,6 +84627,11 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
data-x="">open</code>" and the <code data-x="dom-ToggleEvent-newState">newState</code>
attribute initialized to "<code data-x="">closed</code>" at <var>element</var>.</p></li>

<li><p>If <var>autoPopoverListContainsElement</var> is true and <var>document</var>'s
<span>showing auto popover list</span>'s last item is not <var>element</var>, then run <span
data-x="hide-all-popovers-until">hide all popovers until</span> given <var>element</var>,
<var>focusPreviousElement</var>, and false.</p></li>

<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 run <var>cleanupSteps</var> and
Expand Down Expand Up @@ -84702,6 +84711,10 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
<var>focusPreviousElement</var>, and a boolean <var>fireEvents</var>:</p>

<ol>
<li><p>If <var>endpoint</var> is an <span data-x="HTML elements">HTML element</span> and
<var>endpoint</var> is not in the <span data-x="popover-showing-state">popover showing
state</span>, then return.</p></li>

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

<li>
Expand Down

0 comments on commit e41f54e

Please sign in to comment.