Toolbar Example
NOTE: Please provide feedback on this example page in issue 539.
Following is an example implementation of the design pattern for toolbar that demonstrates how a toolbar can group a set of buttons into a single tab stop. It also illustrates the roving tabindex method for managing focus within a component.
Example
Accessibility Features
- When tabbing into the toolbar, focus returns to the control that last had focus. Focus movement inside the toolbar is managed using roving tabindex.
- Since there is only a single disabled control, to ensure screen reader users are aware of its presence, it is focusable. For additional guidance, see Focusability of disabled controls.
- Since Down Arrow is not used to navigate a horizontal toolbar, the menubutton can be opened with Down Arrow as well as Enter.
Keyboard Support
Key | Function |
---|---|
Tab |
|
Left Arrow |
|
Right Arrow |
|
Home | Moves focus to the first control. |
End | Moves focus to the last control. |
Role, Property, State, and Tabindex Attributes
Role | Attribute | Element | Usage |
---|---|---|---|
toolbar |
div |
|
|
aria-label="LABEL_STRING"
|
div |
|
|
button |
div |
Identifies the element as a button. | |
tabindex=
|
button
|
|
|
tabindex=
|
button
|
|
|
aria-disabled="true" |
button |
Informs assistive technologies of the disabled state. |
Javascript and CSS Source Code
- CSS: toolbar.css
- Javascript: toolbar.js
- CSS: menuButton.css
- Javascript: menuButton.js
- Javascript: main.js
HTML Source Code