Skip to content

Commit

Permalink
Fixes to delegatesFocus
Browse files Browse the repository at this point in the history
* Make it use the shadow tree instead of the flat tree. Closes #7207.
* Make it work with the unfocusing steps symmetrically to the focusing steps. Closes #7070.
  • Loading branch information
domenic authored Nov 1, 2021
1 parent 56071d6 commit 9ba7124
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -75039,9 +75039,10 @@ END:VCARD</pre>

<dd>
<ol>
<li><p>If <var>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 return null.</p></li>
<li><p>If <var>focus target</var>'s <span data-x="concept-element-shadow-root">shadow
root</span> 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 return
null.</p></li>

<li><p>Let <var>autofocus delegate</var> be the <span>autofocus delegate</span> for <var>focus
target</var> given <var>focus trigger</var>.</p></li>
Expand All @@ -75050,17 +75051,22 @@ END:VCARD</pre>
delegate</var>.</p></li>

<li><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>focus target</var> in the <span>flat tree</span>.</p></li>
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 <span>shadow-including
descendant</span> of <var>focus target</var>'s <span
data-x="concept-element-shadow-root">shadow root</span>.</p></li>

<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>focus target</var> in the <span>flat tree</span>.</p></li>
data-x="focusable area">focusable areas</span> whose <span>DOM anchor</span> is a
<span>shadow-including descendant</span> of <var>focus target</var>'s <span
data-x="concept-element-shadow-root">shadow root</span>.</p></li>

<li><p>If <var>possible focus delegates</var> is empty, then return null.</p></li>

<li><p>Sort <var>possible focus delegates</var> by <span>shadow-including tree
order</span> of their <span data-x="DOM anchor">DOM anchors</span>.</p></li>

<li><p>Return the first <span>focusable area</span> in <span>tree order</span> of who their
<span data-x="DOM anchor">DOM anchors</span> are in <var>possible focus delegates</var>, or
null if <var>possible focus delegates</var> is empty.</p></li>
<li><p>Return <var>possible focus delegates</var>[0].</p></li>
</ol>

<p class="note">For <span data-x="sequentially focusable">sequential focusability</span>, the
Expand Down Expand Up @@ -75163,6 +75169,14 @@ END:VCARD</pre>
<!-- https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2819 -->
<!-- https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2822 -->

<li><p>If <var>old 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,
and <var>old focus target</var>'s <span data-x="concept-element-shadow-root">shadow root</span>
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>old focus
target</var> to that <span>currently focused area of a top-level browsing
context</span>.</p></li>

<li><p>If <var>old focus target</var> is <span>inert</span>, then return.</p></li>

<li>
Expand Down

0 comments on commit 9ba7124

Please sign in to comment.