You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/tabs-automatic-activation/reference/2025-6-5_142619/tabs-automatic.activateFourthTabAndSetFocusOnTabpanel.html
To make it easy for screen reader users to navigate from a tab to the beginning of content in the active <code>tabpanel</code>, the <code>tabpanel</code> element has <code>tabindex="0"</code> to include the panel in the page <kbd>Tab</kbd> sequence.
124
-
It is recommended that all <code>tabpanel</code> elements in a tab set are focusable if there are any panels in the set that contain content where the first element in the panel is not focusable.
125
-
</li>
126
-
<li>
127
-
To ensure people who rely on browser or operating system high contrast settings can both distinguish the active (selected) tab from other tabs and perceive keyboard focus:
128
-
<ul>
129
-
<li>
130
-
The active tab has a 2 pixel border on its left and right sides and a 4 pixel border on top, while the names of inactive tabs have 1 pixel borders.
131
-
The active tab is also 4 pixels higher than the inactive tabs.
132
-
</li>
133
-
<li>
134
-
The focus ring is drawn with a CSS border on a child <code>span</code> element of the tab element.
135
-
This focus span is separated from the tab border by 2 pixels of space to ensure focus and selection are separately perceivable.
136
-
Note that when a tab element is focused, the outline of the tab element itself is set to 0 so that only one focus ring is displayed.
137
-
</li>
138
-
<li>
139
-
Because transparent borders are visible on some systems when high contrast settings are enabled, only the focused <code>span</code> element has a visible border.
140
-
When <code>span</code> elements are not indicating focus, they have a 0-width border and additional padding equal in width to the border that is used to indicate focus.
141
-
</li>
142
-
</ul>
143
-
</li>
144
-
<li>
145
-
To ensure the tab content remains visible when the screen is magnified, the width of the tabs and tab panels are defined using a percentage of the screen width. As the page is magnified the height of the tab increases and the tab content re-flows to the new dimensions of the tab.
146
-
</li>
147
-
</ul>
148
-
</section>
149
-
150
-
<section>
151
-
<h2id="kbd_label">Keyboard Support</h2>
152
-
<tablearia-labelledby="kbd_label" class="def">
153
-
<thead>
154
-
<tr>
155
-
<th>Key</th>
156
-
<th>Function</th>
157
-
</tr>
158
-
</thead>
159
-
<tbody>
160
-
<trdata-test-id="key-tab">
161
-
<th><kbd>Tab</kbd></th>
162
-
<td>
163
-
<ul>
164
-
<li>When focus moves into the tab list, places focus on the active <code>tab</code> element .</li>
165
-
<li>When the tab list contains the focus, moves focus to the next element in the tab sequence, which is the <code>tabpanel</code> element.</li>
166
-
</ul>
167
-
</td>
168
-
</tr>
169
-
<trdata-test-id="key-right-arrow">
170
-
<th><kbd>Right Arrow</kbd></th>
171
-
<td>
172
-
<ul>
173
-
<li>Moves focus to the next tab.</li>
174
-
<li>If focus is on the last tab, moves focus to the first tab.</li>
175
-
<li>Activates the newly focused tab.</li>
176
-
</ul>
177
-
</td>
178
-
</tr>
179
-
<trdata-test-id="key-left-arrow">
180
-
<th><kbd>Left Arrow</kbd></th>
181
-
<td>
182
-
<ul>
183
-
<li>Moves focus to the previous tab.</li>
184
-
<li>If focus is on the first tab, moves focus to the last tab.</li>
185
-
<li>Activates the newly focused tab.</li>
186
-
</ul>
187
-
</td>
188
-
</tr>
189
-
<trdata-test-id="key-home">
190
-
<th><kbd>Home</kbd></th>
191
-
<td>Moves focus to the first tab and activates it.</td>
192
-
</tr>
193
-
<trdata-test-id="key-end">
194
-
<th><kbd>End</kbd></th>
195
-
<td>Moves focus to the last tab and activates it.</td>
196
-
</tr>
197
-
</tbody>
198
-
</table>
199
-
</section>
200
-
201
-
<section>
202
-
<h2id="rps_label">Role, Property, State, and Tabindex Attributes</h2>
<td>Indicates that the element serves as a container for a set of tabs.</td>
222
-
</tr>
223
-
<trdata-test-id="tablist-aria-labelledby">
224
-
<td></td>
225
-
<thscope="row">
226
-
<code>aria-labelledby="ID_REFERENCE"</code>
227
-
</th>
228
-
<td>
229
-
<code>div</code>
230
-
</td>
231
-
<td>Provides a label that describes the purpose of the set of tabs.</td>
232
-
</tr>
233
-
<trdata-test-id="tab-role">
234
-
<thscope="row">
235
-
<code>tab</code>
236
-
</th>
237
-
<td></td>
238
-
<td>
239
-
<code>button</code>
240
-
</td>
241
-
<td>
242
-
<ul>
243
-
<li>Indicates the element serves as a tab control.</li>
244
-
<li>When focused, it is automatically activated, causing its associated <code>tabpanel</code> to be displayed.</li>
245
-
<li>Provides a label for its associated <code>tabpanel</code>.</li>
246
-
</ul>
247
-
</td>
248
-
</tr>
249
-
<trdata-test-id="tab-aria-selected">
250
-
<td></td>
251
-
<thscope="row">
252
-
<code>aria-selected="true"</code>
253
-
</th>
254
-
<td>
255
-
<code>button</code>
256
-
</td>
257
-
<td>
258
-
<ul>
259
-
<li>Indicates the tab is selected and its associated tabpanel is displayed.</li>
260
-
<li>Set when a tab receives focus.</li>
261
-
</ul>
262
-
</td>
263
-
</tr>
264
-
<trdata-test-id="tab-aria-selected">
265
-
<td></td>
266
-
<thscope="row">
267
-
<code>aria-selected="false"</code>
268
-
</th>
269
-
<td>
270
-
<code>button</code>
271
-
</td>
272
-
<td>
273
-
<ul>
274
-
<li>Indicates the tab is not selected and its associated tabpanel is <strong>NOT</strong> displayed.</li>
275
-
<li>Set for all tab elements in the tab set except the tab that is selected.</li>
276
-
</ul>
277
-
</td>
278
-
</tr>
279
-
<trdata-test-id="tab-tabindex">
280
-
<td></td>
281
-
<thscope="row">
282
-
<code>tabindex="-1"</code>
283
-
</th>
284
-
<td>
285
-
<code>button</code>
286
-
</td>
287
-
<td>
288
-
<ul>
289
-
<li>Removes the element from the page <kbd>Tab</kbd> sequence.</li>
290
-
<li>Set when a tab is not selected so that only the selected tab is in the page <kbd>Tab</kbd> sequence.</li>
291
-
<li>Since an HTML <code>button</code> element is used for the tab, it is not necessary to set <code>tabindex="0"</code> on the selected (active) tab element.</li>
292
-
<li>
293
-
This approach to managing focus is described in the section on
294
-
<ahref="../../../practices/keyboard-interface/keyboard-interface-practice.html#kbd_roving_tabindex">Managing Focus Within Components Using a Roving tabindex</a>.
295
-
</li>
296
-
</ul>
297
-
</td>
298
-
</tr>
299
-
<trdata-test-id="tab-aria-control">
300
-
<td></td>
301
-
<thscope="row">
302
-
<code>aria-controls="ID_REFERENCE"</code>
303
-
</th>
304
-
<td>
305
-
<code>button</code>
306
-
</td>
307
-
<td>Refers to the element with <code>role=tabpanel</code> associated with the tab.</td>
308
-
</tr>
309
-
<trdata-test-id="tabpanel-role">
310
-
<thscope="row">
311
-
<code>tabpanel</code>
312
-
</th>
313
-
<td></td>
314
-
<td>
315
-
<code>div</code>
316
-
</td>
317
-
<td>
318
-
<ul>
319
-
<li>Indicates the element serves as a container for tab panel content.</li>
320
-
<li>Is hidden unless its associated <code>tab</code> control is activated.</li>
321
-
</ul>
322
-
</td>
323
-
</tr>
324
-
<trdata-test-id="tabpanel-aria-labelledby">
325
-
<td></td>
326
-
<thscope="row">
327
-
<code>aria-labelledby="ID_REFERENCE"</code>
328
-
</th>
329
-
<td>
330
-
<code>div</code>
331
-
</td>
332
-
<td>
333
-
<ul>
334
-
<li>Refers to the <code>tab</code> element that controls the panel.</li>
335
-
<li>Provides an accessible name for the tab panel.</li>
336
-
</ul>
337
-
</td>
338
-
</tr>
339
-
<trdata-test-id="tabpanel-tabindex">
340
-
<td></td>
341
-
<thscope="row">
342
-
<code>tabindex="0"</code>
343
-
</th>
344
-
<td>
345
-
<code>div</code>
346
-
</td>
347
-
<td>
348
-
<ul>
349
-
<li>Puts the tabpanel in the page <kbd>Tab</kbd> sequence.</li>
350
-
<li>Facilitates navigation to panel content for assistive technology users.</li>
351
-
<li>Focusable tabpanel elements are recommended if any panels in a set contain content where the first element in the panel is not focusable.</li>
0 commit comments