Tabs With Automatic Activation
++ Provide feedback on updates to this page in + issue 278. +
This example section demonstrates a tabs widget that implements the design pattern for tabs. - In this example panels are automatically activated when its tab receives focus. + In this example, a tab is automatically activated and its associated panel is displayed when the tab receives focus. + Tabs should only be automatically activated in circumstances where panels can be displayed instantly, i.e., all panel content is present in the DOM. + For additional guidance, see Deciding When to Make Selection Automatically Follow Focus.
Similar examples include:
- Tabs With Manual Activation: A tabs widget where users activate a tab and display its panel by pressing Space or Enter.
Example
-Nils Frahm is a German musician, composer and record producer based in Berlin. He is known for combining classical and electronic music and for an unconventional approach to the piano in which he mixes a grand piano, upright piano, Roland Juno-60, Rhodes piano, drum machine, and Moog Taurus.
-Nils Frahm is a German musician, composer and record producer based in Berlin. He is known for combining classical and electronic music and for an unconventional approach to the piano in which he mixes a grand piano, upright piano, Roland Juno-60, Rhodes piano, drum machine, and Moog Taurus.
+Helios (Keith Kenniff) is an American composer, multi-instrumentalist, and electronic music producer. He composes ambient/electronic music under the moniker Helios and post-classical piano music under Goldmund. He is also one half of the indie band Mint Julep, and ambient project "A Pale Fire". Keith is also a composer for film, television, dance and performance art. In 2010 he created the record label Unseen.
-Helios (Keith Kenniff) is an American composer, multi-instrumentalist, and electronic music producer. He composes ambient/electronic music under the moniker Helios and post-classical piano music under Goldmund. He is also one half of the indie band Mint Julep, and ambient project "A Pale Fire". Keith is also a composer for film, television, dance and performance art. In 2010 he created the record label Unseen.
+Fear of complicated buildings:
-A complex complex complex.
-Fear of complicated buildings:
+A complex complex complex.
Keyboard Support
-
+
- When the tab list is receiving focus, places focus on the active
tab
element .
+ - When the tab list contains the focus, moves focus to the
tabpanel
element.
+
-
+
- Moves focus to the next tab. +
- If focus is on the last tab, moves focus to the first tab. +
- Activates the newly focused tab. +
-
+
- Moves focus to the previous tab. +
- If focus is on the first tab, moves focus to the last tab. +
- Activates the newly focused tab. +
ARIA Roles, Properties, and States
- +Role, Property, State, and Tabindex Attributes
Role | -Property/State | -Element | -Usage | +Role | +Attribute | +Element | +Usage |
---|---|---|---|---|---|---|---|
tablist | +
+ tablist
+ |
+ + |
+ div
+ |
+ Indicates that the element serves as a container for a set of tabs. | +|||
+ |
+ aria-label=
+ |
+
+ div
+ |
+ Provides a label that describes the purpose of the set of tabs. | +||||
+ tab
+ |
+ + |
+ button
+ |
+
+
|
+ ||||
+ |
+ aria-selected=
+ |
+
+ button
+ |
|
||||
tab | + |
+ aria-selected=
+ |
+
+ button
+ |
+
+
|
+ |||
+ |
+ tabindex=
+ |
+
+ button
+ |
|
||||
tabpanel | + |
+ aria-controls=
+ |
+
+ button
+ |
+
+ Refers to the tabpanel element associated with the tab.
+ |
+ |||
+ tabpanel
+ |
+ + |
+ div
+ |
+
+
|
+ ||||
+ |
+ aria-labelledby=
+ |
+
+ div
+ |
|
||||
- | aria-controls | -element with role of tab |
+
+ tabindex=
+ |
+
+ div
+ |
|