Skip to content

Commit 0639fee

Browse files
authored
Editorial: clean up small parts of sequential focus navigation (#10632)
1 parent 65ef915 commit 0639fee

File tree

1 file changed

+77
-51
lines changed

1 file changed

+77
-51
lines changed

source

Lines changed: 77 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -80200,10 +80200,10 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
8020080200

8020180201
<h4><dfn>Sequential focus navigation</dfn></h4>
8020280202

80203-
<p>Each <code>Document</code> has a <dfn>sequential focus navigation order</dfn>, which orders some
80204-
or all of the <span data-x="focusable area">focusable areas</span> in the <code>Document</code>
80205-
relative to each other. Its contents and ordering are given by the <span>flattened
80206-
tabindex-ordered focus navigation scope</span> of the <code>Document</code>.</p>
80203+
<p>Each <code>Document</code> has a <dfn>sequential focus navigation order</dfn>, which orders
80204+
some or all of the <span data-x="focusable area">focusable areas</span> in the
80205+
<code>Document</code> relative to each other. Its contents and ordering are given by the
80206+
<span>flattened tabindex-ordered focus navigation scope</span> of the <code>Document</code>.</p>
8020780207

8020880208
<p class="note">Per the rules defining the <span>flattened tabindex-ordered focus navigation
8020980209
scope</span>, the ordering is not necessarily related to the <span>tree order</span> of the
@@ -80223,10 +80223,21 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
8022380223
point</span> to the <span>target element</span> when <span data-x="navigate-fragid">navigating
8022480224
to a fragment</span>.</p>
8022580225

80226+
<p>A <dfn>sequential focus direction</dfn> is one of two possible values: "<dfn><code
80227+
data-x="sequential-focus-forward">forward</code></dfn>", or "<dfn><code
80228+
data-x="sequential-focus-backward">backward</code></dfn>". They are used in the below algorithms
80229+
to describe the direction in which sequential focus travels at the user's request.</p>
80230+
80231+
<p>A <dfn>selection mechanism</dfn> is one of two possible values: "<dfn><code
80232+
data-x="selection-mechanism-DOM">DOM</code></dfn>", or
80233+
"<dfn><code data-x="selection-mechanism-sequential">sequential</code></dfn>". They are used to
80234+
describe how the <span>sequential navigation search algorithm</span> finds the <span>focusable
80235+
area</span> it returns.</p>
80236+
8022680237
<p>When the user requests that focus move from the <span>currently focused area of a top-level
80227-
traversable</span> to the next or previous <span>focusable area</span> (e.g. as the default
80238+
traversable</span> to the next or previous <span>focusable area</span> (e.g., as the default
8022880239
action of pressing the <kbd><kbd>tab</kbd></kbd> key), or when the user requests that focus
80229-
sequentially move to a <span>top-level traversable</span> in the first place (e.g. from the
80240+
sequentially move to a <span>top-level traversable</span> in the first place (e.g., from the
8023080241
browser's location bar), the user agent must use the following algorithm:</p>
8023180242

8023280243
<ol>
@@ -80240,26 +80251,29 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
8024080251
focus navigation starting point</span> instead.</p></li>
8024180252

8024280253
<li>
80243-
<p>Let <var>direction</var> be <i>forward</i> if the user requested the <em>next</em>
80244-
control, and <i>backward</i> if the user requested the previous control.</p>
80254+
<p>Let <var>direction</var> be "<code data-x="sequential-focus-forward">forward</code>" if the
80255+
user requested the next control, and "<code
80256+
data-x="sequential-focus-backward">backward</code>" if the user requested the previous
80257+
control.</p>
8024580258

80246-
<p class="note">Typically, pressing <kbd><kbd>tab</kbd></kbd> requests the next control, and pressing
80247-
<kbd><kbd>shift</kbd> + <kbd>tab</kbd></kbd> requests the previous control.</p>
80259+
<p class="note">Typically, pressing <kbd><kbd>tab</kbd></kbd> requests the next control, and
80260+
pressing <kbd><kbd>shift</kbd> + <kbd>tab</kbd></kbd> requests the previous control.</p>
8024880261
</li>
8024980262

8025080263
<li>
80251-
<p><i>Loop</i>: Let <var>selection mechanism</var> be <i>sequential</i> if the <var>starting
80252-
point</var> is a <span>navigable</span> or if <var>starting point</var> is in its
80253-
<code>Document</code>'s <span>sequential focus navigation order</span>.</p>
80264+
<p><i>Loop</i>: Let <var>selection mechanism</var> be "<code
80265+
data-x="selection-mechanism-sequential">sequential</code>" if <var>starting point</var> is a
80266+
<span>navigable</span> or if <var>starting point</var> is in its <code>Document</code>'s
80267+
<span>sequential focus navigation order</span>.</p>
8025480268

80255-
<p>Otherwise, <var>starting point</var> is not in its <code>Document</code>'s
80256-
<span>sequential focus navigation order</span>; let <var>selection mechanism</var> be
80257-
<i>DOM</i>.</p>
80269+
<p>Otherwise, <var>starting point</var> is not in its <code>Document</code>'s <span>sequential
80270+
focus navigation order</span>; let <var>selection mechanism</var> be "<code
80271+
data-x="selection-mechanism-DOM">DOM</code>".</p>
8025880272
</li>
8025980273

8026080274
<li><p>Let <var>candidate</var> be the result of running the <span>sequential navigation search
8026180275
algorithm</span> with <var>starting point</var>, <var>direction</var>, and <var>selection
80262-
mechanism</var> as the arguments.</p></li>
80276+
mechanism</var>.</p></li>
8026380277

8026480278
<li><p>If <var>candidate</var> is not null, then run the <span>focusing steps</span> for
8026580279
<var>candidate</var> and return.</p></li>
@@ -80297,23 +80311,26 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
8029780311
</ol>
8029880312

8029980313

80300-
<p>The <dfn>sequential navigation search algorithm</dfn> consists of the following steps. This
80301-
algorithm takes three arguments: <var>starting point</var>, <var>direction</var>,
80302-
and <var>selection mechanism</var>.</p>
80314+
<p>The <dfn>sequential navigation search algorithm</dfn>, given a <span>focusable area</span>
80315+
<var>starting point</var>, <span>sequential focus direction</span> <var>direction</var>, and
80316+
<span>selection mechanism</span> <var>selection mechanism</var>, consists of the following steps.
80317+
They return a <span>focusable area</span>-or-null.</p>
8030380318

8030480319
<ol>
8030580320
<li>
8030680321
<p>Pick the appropriate cell from the following table, and follow the instructions in that
8030780322
cell.</p>
8030880323

80309-
<p>The appropriate cell is the one that is from the column whose header describes <var>direction</var> and from the first row whose header describes <var>starting point</var> and <var>selection mechanism</var>.</p>
80324+
<p>The appropriate cell is the one that is from the column whose header describes
80325+
<var>direction</var> and from the first row whose header describes <var>starting point</var> and
80326+
<var>selection mechanism</var>.</p>
8031080327

8031180328
<table>
8031280329
<thead>
8031380330
<tr>
8031480331
<th>
80315-
<th> <var>direction</var> is <i>forward</i>
80316-
<th> <var>direction</var> is <i>backward</i>
80332+
<th><var>direction</var> is "<code data-x="sequential-focus-forward">forward</code>"
80333+
<th><var>direction</var> is "<code data-x="sequential-focus-backward">backward</code>"
8031780334
<tbody>
8031880335
<tr>
8031980336
<th><var>starting point</var> is a <span>navigable</span>
@@ -80324,45 +80341,54 @@ dictionary <dfn dictionary>ToggleEventInit</dfn> : <span>EventInit</span> {
8032480341
in <var>starting point</var>'s <span data-x="nav-document">active document</span>, if any; or
8032580342
else null
8032680343
<tr>
80327-
<th><var>selection mechanism</var> is <i>DOM</i>
80344+
<th><var>selection mechanism</var> is "<code data-x="selection-mechanism-DOM">DOM</code>"
80345+
<td>
80346+
<p>Let <var>candidate</var> be the <span>suitable sequentially focusable area</span>, that
80347+
appears nearest after <var>starting point</var> in <var>starting point</var>'s
80348+
<code>Document</code>, in <span>shadow-including tree order</span>, if any; or else null</p>
80349+
80350+
<p class="note">In this case, <var>starting point</var> does not necessarily belong to its
80351+
<code>Document</code>'s <span>sequential focus navigation order</span>, so we'll select the
80352+
<span data-x="suitable sequentially focusable area">suitable</span> <span data-x="list
80353+
item">item</span> from that list that comes <em>after</em> <var>starting point</var> in
80354+
<span>shadow-including tree order</span>.</p>
80355+
</td>
80356+
<td>Let <var>candidate</var> be the <span>suitable sequentially focusable area</span>, that
80357+
appears nearest before <var>starting point</var> in <var>starting point</var>'s
80358+
<code>Document</code>, in <span>shadow-including tree order</span>, if any; or else null
80359+
<tr>
80360+
<th><var>selection mechanism</var> is "<code
80361+
data-x="selection-mechanism-sequential">sequential</code>"
8032880362
<td>Let <var>candidate</var> be the first <span>suitable sequentially focusable area</span>
80329-
in the <span>home document</span> following <var>starting point</var>, if any; or else null
80363+
after <var>starting point</var>, in <var>starting point</var>'s <code>Document</code>'s
80364+
<span>sequential focus navigation order</span>, if any; or else null
8033080365
<td>Let <var>candidate</var> be the last <span>suitable sequentially focusable area</span>
80331-
in the <span>home document</span> preceding <var>starting point</var>, if any; or else null
80332-
<tr>
80333-
<th><var>selection mechanism</var> is <i>sequential</i>
80334-
<td>Let <var>candidate</var> be the first <span>suitable sequentially focusable area</span> in the <span>home sequential focus navigation order</span> following <var>starting point</var>, if any; or else null
80335-
<td>Let <var>candidate</var> be the last <span>suitable sequentially focusable area</span> in the <span>home sequential focus navigation order</span> preceding <var>starting point</var>, if any; or else null
80336-
80366+
before <var>starting point</var>, in <var>starting point</var>'s <code>Document</code>'s
80367+
<span>sequential focus navigation order</span>, if any; or else null
8033780368
</table>
8033880369

8033980370
<p>A <dfn>suitable sequentially focusable area</dfn> is a <span>focusable area</span> whose
8034080371
<span>DOM anchor</span> is not <span>inert</span> and is <span>sequentially
8034180372
focusable</span>.</p>
80342-
80343-
<p>The <dfn>home document</dfn> is the <code>Document</code> to which <var>starting point</var>
80344-
belongs.</p>
80345-
80346-
<p>The <dfn>home sequential focus navigation order</dfn> is the <span>sequential focus
80347-
navigation order</span> to which <var>starting point</var> belongs.</p>
80348-
80349-
<p class="note">The <span>home sequential focus navigation order</span> is the <span>home
80350-
document</span>'s <span>sequential focus navigation order</span>, but is only used when the
80351-
<var>starting point</var> is in that <span>sequential focus navigation order</span>
80352-
(when it's not, <var>selection mechanism</var> will be <i>DOM</i>).</p>
8035380373
</li>
8035480374

8035580375
<li>
8035680376
<p>If <var>candidate</var> is a <span>navigable container</span> with a non-null <span>content
80357-
navigable</span>, then let <var>new candidate</var> be the result of running the
80358-
<span>sequential navigation search algorithm</span> with <var>candidate</var>'s <span>content
80359-
navigable</span> as the first argument, <var>direction</var> as the second, and
80360-
<i>sequential</i> <!-- shift-tab from the end in
80361-
https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2855 --> as the third.</p>
80362-
80363-
<p>If <var>new candidate</var> is null, then let <var>starting point</var>
80364-
be <var>candidate</var>, and return to the top of this algorithm. Otherwise, let
80365-
<var>candidate</var> be <var>new candidate</var>.</p>
80377+
navigable</span>, then:</p>
80378+
80379+
<ol>
80380+
<li><p>Let <var>recursive candidate</var> be the result of running the <span>sequential
80381+
navigation search algorithm</span> with <var>candidate</var>'s <span>content navigable</span>,
80382+
<var>direction</var>, and "<code
80383+
data-x="selection-mechanism-sequential">sequential</code>".<!-- shift-tab from the end in
80384+
https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2855 --></p></li>
80385+
80386+
<li><p>If <var>recursive candidate</var> is null, then return the result of running the
80387+
<span>sequential navigation search algorithm</span> with <var>candidate</var>,
80388+
<var>direction</var>, and <var>selection mechanism</var>.</p></li>
80389+
80390+
<li><p>Otherwise, set <var>candidate</var> to <var>recursive candidate</var>.</p></li>
80391+
</ol>
8036680392
</li>
8036780393

8036880394
<li><p>Return <var>candidate</var>.</p></li>

0 commit comments

Comments
 (0)