Content switcher
Design annotations are needed for specific instances shown below, but for the standard content switcher component, Carbon already incorporates accessibility.
What Carbon provides
Carbon bakes keyboard operation into its components, improving the experience of blind users and others who operate via the keyboard. Carbon incorporates many other accessibility considerations, some of which are described below.
Keyboard interactions
Like tabs, content switchers can be automatic or manual. In both instances, the content switcher takes one tab stop, and arrow keys are used to navigate between content tabs.
Automatic and manual switchers differ in how they are activated. For automatic switchers, focus and selection are synchronized. The tabs are selected as the user arrows between them, and the content section under the switcher is updated in real time.
Manual switchers allow the user to arrow between the content tabs without
updating the content section underneath. In the following illustration, the All
content tab can remain selected while focus moves to the Read tab. A content tab
is selected (and its content section updated) by the user pressing Enter
or
Space
.
Design recommendations
Indicate which variant to implement
The automatic and manual switchers are visually indistinguishable in a wireframe, so designers must annotate which variant the team has decided to implement. Since the choice largely concerns technical considerations about potential latency when updating the content section’s information, architects or developers should be involved in the discussion.
Development considerations
Keep these considerations in mind if you are modifying Carbon or creating a custom component.
- The Content switcher is implemented as a
tablist
, with each content tab implemented as a button with a role oftab
. - The selected content tab has attributes
aria-selected="true"
andtabindex="0"
. All other tabs have these attribute values set to"false"
and"-1"
. - See the ARIA authoring practices guidance for tabs for more considerations.
- See Deciding when to make selection automatically follow focus.