Skip to content

Commit 3c57fa2

Browse files
committed
Update key-conflict element behavior.
1 parent 45ac6e6 commit 3c57fa2

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

source

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90235,13 +90235,17 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
9023590235
<ol>
9023690236
<li><p>Let <var>direction</var> be "forward" if the user pressed <kbd>Tab</kbd>, or "backward" if the user pressed <kbd>Shift</kbd>+<kbd>Tab</kbd>.</p></li>
9023790237

90238-
<li><p>Let <var>items</var> be all <span data-x="focusgroup item">focusgroup items</span> in the same <span data-x="focusgroup scope">focusgroup scope</span> as the current <span data-x="key conflict element">key conflict element</span>, in <span>tree order</span>.</p></li>
90238+
<li><p>Let <var>keyConflictElement</var> be the current <span data-x="key conflict element">key conflict element</span>.</p></li>
9023990239

90240-
<li><p>If <var>direction</var> is "forward", let <var>target</var> be the first item in <var>items</var> that follows the current <span data-x="key conflict element">key conflict element</span> in <span>tree order</span> and is <span>focusable</span>.</p></li>
90240+
<li><p>Let <var>candidates</var> be all <span data-x="focusgroup item">focusgroup items</span> in the same <span data-x="focusgroup scope">focusgroup scope</span> as <var>keyConflictElement</var>, excluding <var>keyConflictElement</var> itself.</p></li>
9024190241

90242-
<li><p>If <var>direction</var> is "backward", let <var>target</var> be the last item in <var>items</var> that precedes the current <span data-x="key conflict element">key conflict element</span> in <span>tree order</span> and is <span>focusable</span>.</p></li>
90242+
<li><p>If <var>direction</var> is "forward", let <var>eligibleItems</var> be all items in <var>candidates</var> that follow <var>keyConflictElement</var> in <span>tree order</span>.</p></li>
9024390243

90244-
<li><p>If <var>target</var> is not null, <span>move the focus</span> to <var>target</var>. The focusgroup's <span data-x="last focused item">last focused item</span> must not be considered during this process, though the <code data-x="attr-tabindex">tabindex</code> ordering continues to apply as in normal <span>sequential focus navigation</span>.</p></li>
90244+
<li><p>If <var>direction</var> is "backward", let <var>eligibleItems</var> be all items in <var>candidates</var> that precede <var>keyConflictElement</var> in <span>tree order</span>.</p></li>
90245+
90246+
<li><p>Among <var>eligibleItems</var>, let <var>target</var> be the first item that would be focused according to the following priority order: first, the lowest positive <code data-x="attr-tabindex">tabindex</code> value; then elements with <code data-x="attr-tabindex">tabindex="0"</code> or implicit focusability; and finally, as the lowest priority, elements with <code data-x="attr-tabindex">tabindex="-1"</code>. Within each priority level, order by <span>tree order</span>.</p></li>
90247+
90248+
<li><p>If <var>target</var> is not null, <span>move the focus</span> to <var>target</var>. The focusgroup's <span data-x="last focused item">last focused item</span> must not be considered during this process.</p></li>
9024590249

9024690250
<li><p>Otherwise, follow the normal <span>sequential focus navigation</span> rules.</p></li>
9024790251
</ol>
@@ -90270,6 +90274,29 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
9027090274
</ul>
9027190275
</div>
9027290276

90277+
<div class="example">
90278+
<p>This example shows how authors can control escape behavior using <code data-x="attr-tabindex">tabindex</code> values:</p>
90279+
90280+
<pre><code class="html">&lt;div focusgroup="toolbar" aria-label="Text formatting"&gt;
90281+
&lt;button type="button" tabindex="-1"&gt;Bold&lt;/button&gt;
90282+
&lt;button type="button" tabindex="-1"&gt;Italic&lt;/button&gt;
90283+
&lt;div&gt;
90284+
&lt;input type="text" placeholder="Search" /&gt; &lt;!-- Key conflict element --&gt;
90285+
&lt;button tabindex="1"&gt;Go&lt;/button&gt; &lt;!-- Higher priority --&gt;
90286+
&lt;/div&gt;
90287+
&lt;button type="button" tabindex="-1"&gt;Save&lt;/button&gt; &lt;!-- Lowest priority --&gt;
90288+
&lt;button type="button" tabindex="2"&gt;Print&lt;/button&gt; &lt;!-- Lower priority --&gt;
90289+
&lt;/div&gt;</code></pre>
90290+
90291+
<p>In this modified example, the priority order for escape behavior is:</p>
90292+
<ul>
90293+
<li>Pressing <kbd>Tab</kbd> from within the search input moves focus to the "Go" button (highest priority due to <code data-x="attr-tabindex">tabindex="1"</code>)</li>
90294+
<li>If the "Go" button wasn't present, <kbd>Tab</kbd> would move to the "Print" button (medium priority due to <code data-x="attr-tabindex">tabindex="2"</code>)</li>
90295+
<li>If neither positive <code data-x="attr-tabindex">tabindex</code> elements were present, <kbd>Tab</kbd> would move to the "Save" button (lowest priority due to <code data-x="attr-tabindex">tabindex="-1"</code>)</li>
90296+
<li>Elements with <code data-x="attr-tabindex">tabindex="-1"</code> are considered as the fallback option when no higher-priority elements are available</li>
90297+
</ul>
90298+
</div>
90299+
9027390300
<h6>Directional Navigation</h6>
9027490301

9027590302
<div algorithm>

0 commit comments

Comments
 (0)