Skip to content

Commit b4e1fb1

Browse files
authored
Add popover source connection
This includes two related changes: 1. The showPopover() and togglePopover() methods now include an options bag that allows setting the popover source. 2. Popover sources (declaratively or imperatively set) now create an implicit anchor reference for that popover. See discussion in whatwg#9144 (comment). Closes whatwg#10442. Closes whatwg#10675.
1 parent 316b83b commit b4e1fb1

File tree

1 file changed

+53
-10
lines changed

1 file changed

+53
-10
lines changed

source

Lines changed: 53 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4192,6 +4192,12 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
41924192
<li><dfn data-x-href="https://drafts.csswg.org/css-contain/#content-visibility">'content-visibility'</dfn> property</li>
41934193
<li><dfn data-x-href="https://drafts.csswg.org/css-contain/#propdef-content-visibility" data-x="content-visibility-auto">'auto'</dfn> value for <span>'content-visibility'</span></li>
41944194
</ul>
4195+
4196+
<p>The following terms are defined in <cite>CSS Anchor Positioning</cite>: <ref>CSSANCHOR</ref></p>
4197+
4198+
<ul class="brief">
4199+
<li><dfn data-x-href="https://drafts.csswg.org/css-anchor-position/#implicit-anchor-element">implicit anchor element</dfn></li>
4200+
</ul>
41954201
</dd>
41964202

41974203

@@ -11924,12 +11930,20 @@ interface <dfn interface>HTMLElement</dfn> : <span>Element</span> {
1192411930
<span>ElementInternals</span> <span data-x="dom-attachInternals">attachInternals</span>();
1192511931

1192611932
// The popover API
11927-
undefined <span data-x="dom-showPopover">showPopover</span>();
11933+
undefined <span data-x="dom-showPopover">showPopover</span>(optional <span>ShowPopoverOptions</span> options = {});
1192811934
undefined <span data-x="dom-hidePopover">hidePopover</span>();
11929-
boolean <span data-x="dom-togglePopover">togglePopover</span>(optional boolean force);
11935+
boolean <span data-x="dom-togglePopover">togglePopover</span>(optional (<span>TogglePopoverOptions</span> or boolean) options = {});
1193011936
[<span>CEReactions</span>] attribute DOMString? <span data-x="dom-popover">popover</span>;
1193111937
};
1193211938

11939+
dictionary <dfn dictionary>ShowPopoverOptions</dfn> {
11940+
<span>HTMLElement</span> <dfn dict-member for="ShowPopoverOptions" data-x="dom-ShowPopoverOptions-source">source</dfn>;
11941+
};
11942+
11943+
dictionary <dfn dictionary>TogglePopoverOptions</dfn> : <span>ShowPopoverOptions</span> {
11944+
boolean <dfn dict-member for="TogglePopoverOptions" data-x="dom-TogglePopoverOptions-force">force</dfn>;
11945+
};
11946+
1193311947
<span>HTMLElement</span> includes <span>GlobalEventHandlers</span>;
1193411948
<span>HTMLElement</span> includes <span>ElementContentEditable</span>;
1193511949
<span>HTMLElement</span> includes <span>HTMLOrSVGElement</span>;
@@ -85525,8 +85539,17 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
8552585539
false.</dd>
8552685540
</dl>
8552785541

85528-
<p>The <dfn method for="HTMLElement"><code data-x="dom-showPopover">showPopover()</code></dfn>
85529-
method steps are to run <span>show popover</span> given <span>this</span>, true, and null.</p>
85542+
<p>The <dfn method for="HTMLElement"><code
85543+
data-x="dom-showPopover">showPopover(<var>options</var>)</code></dfn> method steps are:</p>
85544+
85545+
<ol>
85546+
<li><p>Let <var>invoker</var> be <var>options</var>["<code
85547+
data-x="dom-ShowPopoverOptions-source">source</code>"] if it <span data-x="map
85548+
exists">exists</span>; otherwise, null.</p></li>
85549+
85550+
<li><p>Run <span>show popover</span> given <span>this</span>, true, and
85551+
<var>invoker</var>.</p></li>
85552+
</ol>
8553085553

8553185554
<p>To <dfn>show popover</dfn>, given an <span data-x="HTML elements">HTML element</span>
8553285555
<var>element</var>, a boolean <var>throwExceptions</var>, and an <span data-x="HTML elements">HTML
@@ -85655,6 +85678,9 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
8565585678

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

85681+
<li><p>Set <var>element</var>'s <span>implicit anchor element</span> to
85682+
<var>invoker</var>.</p></li>
85683+
8565885684
<li><p>Run the <span>popover focusing steps</span> given <var>element</var>.</p></li>
8565985685

8566085686
<li><p>If <var>shouldRestoreFocus</var> is true and <var>element</var>'s <code
@@ -85805,6 +85831,8 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
8580585831

8580685832
<li><p><span>Request an element to be removed from the top layer</span> given
8580785833
<var>element</var>.</p></li>
85834+
85835+
<li><p>Set <var>element</var>'s <span>implicit anchor element</span> to null.</p></li>
8580885836
</ol>
8580985837
</li>
8581085838

@@ -85839,16 +85867,28 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
8583985867
</ol>
8584085868

8584185869
<p>The <dfn method for="HTMLElement"><code
85842-
data-x="dom-togglePopover">togglePopover(<var>force</var>)</code></dfn> method steps are:</p>
85870+
data-x="dom-togglePopover">togglePopover(<var>options</var>)</code></dfn> method steps are:</p>
8584385871

8584485872
<ol>
85873+
<li><p>Let <var>force</var> be null.</p></li>
85874+
85875+
<li><p>If <var>options</var> is a boolean, set <var>force</var> to <var>options</var>.</p></li>
85876+
85877+
<li><p>Otherwise, if <var>options</var>["<code
85878+
data-x="dom-TogglePopoverOptions-force">force</code>"] <span data-x="map exists">exists</span>,
85879+
set <var>force</var> to <var>options</var>["<code
85880+
data-x="dom-TogglePopoverOptions-force">force</code>"].</p></li>
85881+
85882+
<li><p>Let <var>invoker</var> be <var>options</var>["<code
85883+
data-x="dom-ShowPopoverOptions-source">source</code>"] if it <span data-x="map
85884+
exists">exists</span>; otherwise, null.</p></li>
85885+
8584585886
<li><p>If <span>this</span>'s <span>popover visibility state</span> is <span
85846-
data-x="popover-showing-state">showing</span>, and <var>force</var> is not present or false, then
85847-
run the <span>hide popover algorithm</span> given <span>this</span>, true, true, and
85848-
true.</p></li>
85887+
data-x="popover-showing-state">showing</span>, and <var>force</var> is null or false, then run
85888+
the <span>hide popover algorithm</span> given <span>this</span>, true, true, and true.</p></li>
8584985889

85850-
<li><p>Otherwise, if <var>force</var> is not present or true, then run <span>show popover</span>
85851-
given <span>this</span>, true, and null.</p></li>
85890+
<li><p>Otherwise, if <var>force</var> is null or true, then run <span>show popover</span> given
85891+
<span>this</span>, true, and <var>invoker</var>.</p></li>
8585285892

8585385893
<li>
8585485894
<p>Otherwise:</p>
@@ -144542,6 +144582,9 @@ INSERT INTERFACES HERE
144542144582
<dt id="refsCSSALIGN">[CSSALIGN]</dt>
144543144583
<dd><cite><a href="https://w3c.github.io/csswg-drafts/css-align/">CSS Box Alignment</a></cite>, E. Etemad, T. Atkins. W3C.</dd>
144544144584

144585+
<dt id="refsCSSANCHOR">[CSSANCHOR]</dt>
144586+
<dd><cite><a href="https://drafts.csswg.org/css-anchor-position/">CSS Anchor Positioning</a></cite>, T. Atkins, E. Etemad, I. Kilpatrick. W3C.</dd>
144587+
144545144588
<dt id="refsCSSANIMATIONS">[CSSANIMATIONS]</dt>
144546144589
<dd><cite><a href="https://w3c.github.io/csswg-drafts/css-animations/">CSS Animations</a></cite>, D. Jackson, D. Hyatt, C. Marrin, S. Galineau, L. Baron. W3C.</dd>
144547144590

0 commit comments

Comments
 (0)