Capítulo 46 de 51

Chapter 46: Toolbar

Core Idea

A roving-tabindex container for mixed control types (buttons, links, an input, grouped sub-sections) sharing one Tab stop with arrow-key movement between controls — the key usage constraint is that arrow keys are overloaded for both toolbar navigation and (inside an Input) text-cursor movement.

Key Concepts

  • Usage guideline (critical): left/right arrow keys move both the toolbar focus and an input's text cursor. If a horizontal toolbar contains an Toolbar.Input, use at most one, and place it as the last element — otherwise arrow-key navigation and text editing conflict.
  • Anatomy: RootButton, Link, Separator, Group (→ nested Buttons), Input.
  • Mixed controls, one roving tabindex: unlike Menu/RadioGroup (homogeneous items), Toolbar coordinates heterogeneous control types (Button, Link, Input) under the same single-Tab-stop + arrow-key model.
  • Group: visually/semantically clusters related buttons (e.g. a formatting sub-group) within the toolbar without breaking the shared roving-tabindex sequence.
  • focusableWhenDisabled: on Button/Input, keeps a disabled control focusable (and thus part of the arrow-key sequence and screen-reader-discoverable) instead of removing it from the tab order entirely — important so users can discover why something is disabled instead of it silently vanishing from navigation.

Reference Tables

PartNotable propsNotable data attributes
RootloopFocus, orientation, disableddata-orientation, data-disabled
ButtonfocusableWhenDisabled, nativeButton, disableddata-focusable, data-disabled
InputfocusableWhenDisabled, defaultValuedata-focusable, data-disabled
Groupdisableddata-orientation, data-disabled
Linkdata-orientation

Key Takeaways

  1. Never place more than one Toolbar.Input in a horizontal toolbar, and always place it last — this is an explicit, easy-to-violate accessibility guideline in the docs, not just a suggestion.
  2. Use focusableWhenDisabled on disabled toolbar buttons by default — an unreachable disabled button is a worse UX than a focusable-but-inert one for keyboard/AT users trying to understand toolbar state.
  3. Use Group to visually cluster related buttons (e.g. text-align left/center/right) without breaking the toolbar's single shared roving-tabindex sequence.

Connects To

  • ch045 (Toggle Group): commonly nested inside a Toolbar for formatting-button clusters.
  • ch015 (Button): Toolbar.Button follows the same nativeButton/semantics rules.