Skip to content

Commit

Permalink
Add popover default behavior for invoke targets
Browse files Browse the repository at this point in the history
This specifies what buttons with an invoketarget pointing to an element
with `popover` should do, based on the Invokers proposal (#9625).

This introduces new specifications just within the "invoke target attribute activation behavior" algorithm such that:

 - If an `invoketarget` points to an element with `popover`
    - If the `invokeaction` is `auto` or `togglePopover`, try to toggle the popover
    - If the `invokeaction` is `hidePopover`, try to hide the popover
    - If the `invokeaction` is `showPopover`, try to show the popover

If the `invokeaction` is none of the above, then it will fall through
the logic and be passed over to the "invocation action algorithm" for
the invokee element, if present.

Things NOT covered in this commit that are included in the propoal (#9625):

- Default per element behaviours (invocation action algorithms) beyond
  popovers. These will be dealt with in subsequent commits adding each
  elements "invocation action algorithm".

- `interestaction` and `interesttarget`.
  • Loading branch information
keithamus committed Oct 22, 2023
1 parent 834a8b1 commit b7a409f
Showing 1 changed file with 65 additions and 3 deletions.
68 changes: 65 additions & 3 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -84988,9 +84988,71 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
data-x="dom-invokeevent-invoker">invoker</code> set to <var>node</var>, and its <code
data-x="dom-Event-cancelable">cancelable</code> attribute initialized to true.</p></li>

<li><p>If <var>notCancelled</var> is true and <var>invokee</var> has an associated
<span>invocation action algorithm</span> then run the <var>invokee's</var> <span>invocation
action algorithm</span> given <var>action</var>.
<li>
<p>If <var>notCancelled</var> is true:</p>

<ol>
<li>Let <var>shouldShowPopover</var> be false.

<li>Let <var>shouldHidePopover</var> be false.

<li><p>If <var>action</var> is an <span>ASCII case-insensitive</span> match for "<code
data-x="">togglePopover</code>" or "<code data-x="">auto</code>", then:</p>

<ol>

<li><p>If <var>invokee</var>'s <span>popover visibility state</span> is <span
data-x="popover-hidden-state">hidden</span>, then set <var>shouldShowPopover</var> to
true.</p></li>

<li><p>Otherwise set <var>shouldHidePopover</var> to true.</p></li>

</ol>

</li>

<li><p>if <var>action</var> is an <span>ASCII case-insensitive</span> match for "<code
data-x="">hidePopover</code>", and <var>invokee</var>'s <span>popover visibility
state</span> is <span data-x="popover-showing-state">showing</span>, then set
<var>shouldHidePopover</var> to true.

<li><p>if <var>action</var> is an <span>ASCII case-insensitive</span> match for "<code
data-x="">showPopover</code>", and <var>invokee</var>'s <span>popover visibility
state</span> is <span data-x="popover-hidden-state">hidden</span>, then set
<var>shouldShowPopover</var> to true.

<li><p>If <var>shouldShowPopover</var> is true, then:</p>

<ol>

<li><p><span>Assert</span>: <var>shouldHidePopover</var> is false.</p></li>

<li><p>Run the <span>show popover</span> given <var>invokee</var>, false, and <var>node</var>.</p></li>

</ol>

</li>

<li><p>Otherwise, if <var>shouldHidePopover</var> is true and the result of
running <span>check popover validity</span> given <var>popover</var>, false, false, and null
is true, then:</p>

<ol>

<li><p><span>Assert</span>: <var>shouldShowPopover</var> is false.</p></li>

<li><p>Run the <span>hide popover algorithm</span> given <var>invokee</var>, true, true, and false.</p></li>

</ol>

</li>

<li><p>Otherwise, if <var>invokee</var> has an associated <span>invocation action algorithm</span>
then run the <var>invokee's</var> <span>invocation action algorithm</span> given <var>action</var>.</p></li>

</ol>

</li>

</ol>

Expand Down

0 comments on commit b7a409f

Please sign in to comment.