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 committed Oct 28, 2021
1 parent 3ad5159 commit 8615199
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -75042,9 +75042,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 @@ -75053,17 +75054,19 @@ 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>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 the first <span>focusable area</span> in <span>shadow-including 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>
</ol>

<p class="note">For <span data-x="sequentially focusable">sequential focusability</span>, the
Expand Down Expand Up @@ -75166,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 8615199

Please sign in to comment.