Skip to content

Commit

Permalink
Tweak shadow host focus delegation
Browse files Browse the repository at this point in the history
In particular, don't delegate focus when the shadow host is an ancestor
of the currently focused area.

Fixes WICG/webcomponents#840.

Tests: web-platform-tests/wpt#19867.
  • Loading branch information
rakina authored and domenic committed Oct 28, 2019
1 parent 3f3b8c2 commit 3bbb870
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions source
Expand Up @@ -74009,7 +74009,7 @@ END:VCARD</pre>

<dd>

<p>Let <var>new focus target</var> be the <code>Document</code>'s <span>viewport</span>.</p>
<p>Set <var>new focus target</var> to the <code>Document</code>'s <span>viewport</span>.</p>

</dd>

Expand Down Expand Up @@ -74040,18 +74040,30 @@ END:VCARD</pre>

<dd>

<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>
<ol>
<li>If <var>new focus target</var> is a <span>shadow-including inclusive ancestor</span> of
the <span>currently focused area of a top-level browsing context</span>'s <span>DOM
anchor</span>, then set <var>new focus target</var> to null.</li>

<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>
<li>
<p>Otherwise:</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>
<ol>
<li>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>.</li>

<li>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>.</li>

<li>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.</li>
</ol>
</li>
</ol>

<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
Expand Down

0 comments on commit 3bbb870

Please sign in to comment.