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

Handle shadow host with delegatesFocus=true in focusing steps (click focus + focus()) #4796

Merged
merged 8 commits into from
Oct 16, 2019
93 changes: 68 additions & 25 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -3921,6 +3921,12 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
algorithms for <code>DOMMatrix2DInit</code> or <code>DOMMatrixInit</code></li>
</ul>

<p>The following terms are defined in the <cite>CSS Scoping</cite>: <ref spec=CSSSCOPING></p>

<ul class="brief">
<li><dfn data-x-href="https://drafts.csswg.org/css-scoping/#flat-tree">flat tree</dfn></li>
</ul>

</dd>

<dt>Intersection Observer</dt>
Expand Down Expand Up @@ -73566,13 +73572,6 @@ END:VCARD</pre>
in this specification.</p>
<!-- TODO(kochi): update "in a document tree" for shadow trees -->

<p><span data-x="focusable area">Focusable areas</span> in a <code>Document</code>
are ordered relative to the <span>tree order</span> of their <span data-x="DOM anchor">DOM
anchors</span>. <span data-x="focusable area">Focusable areas</span> with the same <span>DOM
anchor</span> in a <code>Document</code> are ordered relative to their <span data-x="CSS box">CSS
boxes</span>' relative positions in a pre-order, depth-first traversal of the box tree. <ref
spec=CSS></p>

<hr>
domenic marked this conversation as resolved.
Show resolved Hide resolved

<p>The <dfn>currently focused area of a top-level browsing context</dfn> at any particular time is
Expand Down Expand Up @@ -73694,9 +73693,15 @@ END:VCARD</pre>
focusable via user interaction, only via programmatic APIs.</p>
</div>

<p>If the <span>activation behavior</span> of a <span>click focusable</span> <span>focusable
area</span> is triggered, the user agent must run the <span>focusing steps</span> on the
<span>focusable area</span>'s <span>DOM anchor</span>.</p>
<p>When a user <a href="#activation">activates</a> a <span>click focusable</span> <span>focusable
area</span>, the user agent must run the <span>focusing steps</span> on the <span>focusable
area</span> with <var>focus trigger</var> set to "click".</p>

<div class="note">
Note that focusing is not an activation behavior, i.e. calling the <code
data-x="dom-click">click()</code> method on an element or dispatching a synthetic <code
data-x="event-click">click</code> event on it won't cause the element to get focused.
</div>

<hr>

Expand Down Expand Up @@ -74008,8 +74013,8 @@ END:VCARD</pre>

<p>The <dfn data-export="">focusing steps</dfn> for an object <var>new focus target</var> that is
either a <span>focusable area</span>, or an element that is not a <span>focusable area</span>, or
a <span>browsing context</span>, are as follows. They can optionally be run with a <i>fallback
target</i>.</p>
a <span>browsing context</span>, are as follows. They can optionally be run with a <var>fallback
target</var> and a string <var>focus trigger</var>.</p>

<ol>

Expand All @@ -74028,8 +74033,8 @@ END:VCARD</pre>

<dd>

<p>Let <var>new focus target</var> be the shape corresponding to the first
<code>img</code> element in <span>tree order</span> that uses the image map to which the <code>area</code>
<p>Set <var>new focus target</var> to the shape corresponding to the first <code>img</code>
element in <span>tree order</span> that uses the image map to which the <code>area</code>
element belongs.</p>

</dd>
Expand All @@ -74040,8 +74045,8 @@ END:VCARD</pre>

<dd>

<p>Let <var>new focus target</var> be the element's first scrollable region,
according to a pre-order, depth-first traversal of the box tree. <ref spec=CSS></p>
<p>Set <var>new focus target</var> to the element's first scrollable region, according to a
pre-order, depth-first traversal of the <span>flat tree</span>. <ref spec=CSSSCOPING></p>

</dd>

Expand All @@ -74060,7 +74065,7 @@ END:VCARD</pre>

<dd>

<p>Let <var>new focus target</var> be the <span>browsing context</span>'s
<p>Set <var>new focus target</var> to the <span>browsing context</span>'s
<span>active document</span>.</p>

</dd>
Expand All @@ -74071,31 +74076,66 @@ END:VCARD</pre>

<dd>

<p>Let <var>new focus target</var> be the <span>browsing context container</span>'s <span>nested browsing context</span>'s
<span>active document</span>.</p>
<p>Set <var>new focus target</var> to the <span>browsing context container</span>'s
<span>nested browsing context</span>'s <span>active document</span>.</p>

</dd>


<dt>Otherwise</dt>
<dt>If <var>new focus target</var> is a <span>shadow host</span> whose <span
data-x="concept-element-shadow-root">shadow root</span>'s <span>delegates focus</span> is
true</dt>

<dd>

<p>If no <i>fallback target</i> was specified, abort the <span>focusing steps</span>.</p>
<p>If <var>focus trigger</var> is "<code data-x="">click</code>", then let <var>possible focus
delegates</var> be the list of all <span>click focusable</span> <span data-x="focusable
area">focusable areas</span> whose <span>DOM anchor</span> is a descendant of <var>new focus
target</var> in the <span>flat tree</span>.</p>

<p>Otherwise, let <var>new focus target</var> be the <i>fallback target</i>.</p>
<p>Otherwise, let <var>possible focus delegates</var> be the list of all <span
data-x="focusable area">focusable areas</span> whose <span>DOM anchor</span> is a descendant
of <var>new focus target</var> in the <span>flat tree</span>.</p>

<p>Set <var>new focus target</var> to the first <span>focusable area</span> in <span>tree
order</span> of their <span data-x="DOM anchor">DOM anchors</span> in <var>possible focus
delegates</var>, or null if <var>possible focus delegates</var> is empty.</p>

<p class="note">For <span data-x="sequentially focusable">sequential focusability</span>, the
handling of <span data-x="shadow host">shadow hosts</span> and <span>delegates focus</span> is
done when constructing the <span>sequential focus navigation order</span>. That is, the
<span>focusing steps</span> will never be called on such <span data-x="shadow host">shadow
hosts</span> as part of sequential focus navigation.</p>

</dd>

<dt>Otherwise</dt>

<dd>
<p>Set <var>new focus target</var> to null.</p>
</dd>

</dl>

</li>

<li>

<p>If <var>new focus target</var> is null, then:</p>

<ol>
<li><p>If no <var>fallback target</var> was specified, then return.</p></li>

<li><p>Otherwise, set <var>new focus target</var> to the <var>fallback
target</var>.</p></li>
</ol>

</li>

<li>

<!-- https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2818 -->
<p>If <var>new focus target</var> is a <span>browsing context container</span> with
non-null <span>nested browsing context</span>, then let <var>new focus target</var> be the
non-null <span>nested browsing context</span>, then set <var>new focus target</var> to the
<span>nested browsing context</span>'s <span>active document</span>, and redo this step.</p>

</li>
Expand Down Expand Up @@ -84763,7 +84803,7 @@ new PaymentRequest(&hellip;); // Allowed to use
set to "nearest". <ref spec=CSSOMVIEW></p></li>

<li><p>Run the <span>focusing steps</span> for <var>target</var>, with the
<code>Document</code>'s <span>viewport</span> as the <i>fallback target</i>.</p></li>
<code>Document</code>'s <span>viewport</span> as the <var>fallback target</var>.</p></li>

<li><p>Move the <span>sequential focus navigation starting point</span> to
<var>target</var>.</p></li>
Expand Down Expand Up @@ -123681,6 +123721,9 @@ INSERT INTERFACES HERE
<dt id="refsCSSRUBY">[CSSRUBY]</dt>
<dd><cite><a href="https://drafts.csswg.org/css-ruby/">CSS3 Ruby Module</a></cite>, R. Ishida. W3C.</dd>

<dt id="refsCSSSCOPING">[CSSSCOPING]</dt>
<dd><cite><a href="https://drafts.csswg.org/css-scoping/">CSS Scoping Module</a></cite>, T. Atkins. W3C.</dd>

<dt id="refsCSSSIZING">[CSSSIZING]</dt>
<dd><cite><a href="https://drafts.csswg.org/css-sizing/">CSS Intrinsic &amp; Extrinsic Sizing Module</a></cite>, T. Atkins, E. Etemad. W3C.</dd>

Expand Down