Skip to content

Commit fc2339b

Browse files
committed
Update key-conflict element behavior.
1 parent 5250133 commit fc2339b

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
@@ -90239,13 +90239,17 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
9023990239
<ol>
9024090240
<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>
9024190241

90242-
<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>
90242+
<li><p>Let <var>keyConflictElement</var> be the current <span data-x="key conflict element">key conflict element</span>.</p></li>
9024390243

90244-
<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>
90244+
<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>
9024590245

90246-
<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>
90246+
<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>
9024790247

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, though the <code data-x="attr-tabindex">tabindex</code> ordering continues to apply as in normal <span>sequential focus navigation</span>.</p></li>
90248+
<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>
90249+
90250+
<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>
90251+
90252+
<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>
9024990253

9025090254
<li><p>Otherwise, follow the normal <span>sequential focus navigation</span> rules.</p></li>
9025190255
</ol>
@@ -90274,6 +90278,29 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> {
9027490278
</ul>
9027590279
</div>
9027690280

90281+
<div class="example">
90282+
<p>This example shows how authors can control escape behavior using <code data-x="attr-tabindex">tabindex</code> values:</p>
90283+
90284+
<pre><code class="html">&lt;div focusgroup="toolbar" aria-label="Text formatting"&gt;
90285+
&lt;button type="button" tabindex="-1"&gt;Bold&lt;/button&gt;
90286+
&lt;button type="button" tabindex="-1"&gt;Italic&lt;/button&gt;
90287+
&lt;div&gt;
90288+
&lt;input type="text" placeholder="Search" /&gt; &lt;!-- Key conflict element --&gt;
90289+
&lt;button tabindex="1"&gt;Go&lt;/button&gt; &lt;!-- Higher priority --&gt;
90290+
&lt;/div&gt;
90291+
&lt;button type="button" tabindex="-1"&gt;Save&lt;/button&gt; &lt;!-- Lowest priority --&gt;
90292+
&lt;button type="button" tabindex="2"&gt;Print&lt;/button&gt; &lt;!-- Lower priority --&gt;
90293+
&lt;/div&gt;</code></pre>
90294+
90295+
<p>In this modified example, the priority order for escape behavior is:</p>
90296+
<ul>
90297+
<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>
90298+
<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>
90299+
<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>
90300+
<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>
90301+
</ul>
90302+
</div>
90303+
9027790304
<h6>Directional Navigation</h6>
9027890305

9027990306
<div algorithm>

0 commit comments

Comments
 (0)