Skip to content

Commit

Permalink
Fix corner case invoker issue with popover nested inside invoker
Browse files Browse the repository at this point in the history
In this situation:

```
<button popovertarget=foo>Activate
  <div popover id=foo>Clicking me shouldn't close me</div>
</button>
```

clicking the button properly activates the popover, however, clicking on the popover itself after that should **not** close the popover. It currently does because the popover click bubbles to the `<button>` and activates the invoker, which toggles the popover closed.

This patch fixes that case.
  • Loading branch information
mfreed7 committed Nov 16, 2024
1 parent b4e1fb1 commit b28a9f9
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -48192,8 +48192,9 @@ interface <dfn interface>HTMLInputElement</dfn> : <span>HTMLElement</span> {
<li><p>Run <var>element</var>'s <dfn>input activation behavior</dfn>, if any, and do nothing
otherwise.</p></li>

<li><p>Run the <span>popover target attribute activation behavior</span> on
<var>element</var>.</p></li>
<li><p>Run the <span>popover target attribute activation behavior</span> given
<var>element</var> and <var>event</var>'s
<span data-x="concept-event-target">target</span>.</p></li>
</ol>

<p class="note">Recall that an element's <span>activation behavior</span> runs for both
Expand Down Expand Up @@ -53491,7 +53492,8 @@ interface <dfn interface>HTMLButtonElement</dfn> : <span>HTMLElement</span> {
</li>

<li><p>Run the <span>popover target attribute activation behavior</span> given
<var>element</var>.</p></li>
<var>element</var> and <var>event</var>'s
<span data-x="concept-event-target">target</span>.</p></li>
</ol>

</div>
Expand Down Expand Up @@ -86359,13 +86361,16 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
attribute, <span>limited to only known values</span>.</p>

<p>To run the <dfn>popover target attribute activation behavior</dfn> given a <code>Node</code>
<var>node</var>:</p>
<var>node</var> and an <code>EventTarget</code> <var>eventTarget</var>:</p>

<ol>
<li><p>Let <var>popover</var> be <var>node</var>'s <span>popover target element</span>.</p></li>

<li><p>If <var>popover</var> is null, then return.</p></li>

<li><p>If <var>eventTarget</var> is a <span>shadow-including inclusive descendant</span> of
<var>popover</var>, then return.</p></li>

<li><p>If <var>node</var>'s <code data-x="attr-popovertargetaction">popovertargetaction</code>
attribute is in the <span data-x="attr-popovertargetaction-show">show</span> state and
<var>popover</var>'s <span>popover visibility state</span> is <span
Expand Down

0 comments on commit b28a9f9

Please sign in to comment.