Build keyboard-navigable tabs and toolbars

8 steps · about 1 h 50 min · Intermediate

  1. Learn the tabs pattern roles and keys (reference, W3C WAI ARIA APG, 15 min)

    Lists roles, states and the expected keyboard behaviour.

  2. Build tabs that activate on focus (tutorial, W3C WAI ARIA APG, 20 min)

    Working code for automatic activation with arrow keys.

  3. Build tabs that activate on Enter or Space (tutorial, W3C WAI ARIA APG, 15 min)

    The variant to use when panels are slow to load.

  4. Move focus with a roving tabindex (article, web.dev, 15 min)

    Explains tabindex values and the roving technique in code.

  5. Wire tab, tablist and tabpanel together (reference, MDN, 10 min)

    Shows aria-selected and aria-controls with a full example.

  6. Group buttons into one tab stop with a toolbar (reference, W3C WAI ARIA APG, 10 min)

    Applies the same roving focus to formatting toolbars.

  7. Build a single or multi-select listbox (reference, W3C WAI ARIA APG, 15 min)

    Adds selection and type-ahead to arrow-key navigation.

  8. Know when a menubar is the wrong pattern (reference, W3C WAI ARIA APG, 10 min)

    Clarifies app menus versus site navigation links.