domestic-ui GitHub

Toolbar

A row of related controls that is one stop in the tab order.

Where a toolbar is used A toolbar is a row of related buttons at the top of the area it acts on, such as the formatting buttons above a text editor.

Live example

Text formatting

<dui-toolbar role="toolbar" aria-label="Text formatting">
  <button type="button" aria-pressed="true">Bold</button>
  <button type="button" aria-pressed="false">Italic</button>
  <button type="button" aria-pressed="false">Underline</button>
  <hr>
  <button type="button">Insert link</button>
  <button type="button">Clear formatting</button>
</dui-toolbar>

Vertical

<dui-toolbar role="toolbar" aria-label="Drawing tools" aria-orientation="vertical">
  <button type="button" aria-pressed="true">Select</button>
  <button type="button" aria-pressed="false">Pen</button>
  <button type="button" aria-pressed="false">Eraser</button>
</dui-toolbar>

Attributes

Attribute or valueWhereEffect
role="toolbar" aria-label="…"the container (<dui-toolbar> or any element)
aria-orientation="vertical"optional; default horizontal
aria-pressed="true | false"toggle buttons (native ARIA)
<hr>a separator between groups of controls

Keyboard

KeyAction
Tabmoves into the toolbar (to the last focused control), then out of it
Right Arrow / Left Arrownext or previous control, wrapping (swapped in right-to-left)
Down Arrow / Up Arrowthe same in a vertical toolbar
Home / Endfirst or last control
Enter / Spaceactivates the focused button

Accessibility

  • Use a toolbar for three or more controls. Without JavaScript, each control is a Tab stop.
  • Toggle buttons use aria-pressed, shown by more than color (WCAG 1.4.1).

Specifications

See also

How other systems do it

For comparison only; these are not the standard this system follows.

Search