Search results

Accessibility in Vue TreeView component

09 Jun 2021 / 2 minutes to read

The TreeView component has been designed keeping in mind the WAI-ARIA specifications, and applies WAI-ARIA roles, states, and properties along with keyboard support. This component is characterized by complete keyboard interaction support and ARIA accessibility support that makes it easy for people who use assistive technologies (AT) and those who completely rely on keyboard navigation.

ARIA attributes

The TreeView component uses the tree role, and each tree parent node has a group role where each node has treeitem role. The following ARIA attributes are used in TreeView:

Properties Functionalities
aria-multiselectable Indicates whether the TreeView enables multiple selection or not.
aria-expanded Indicates whether the parent node has expanded or not.
aria-selected Indicates the selected node.
aria-grabbed Indicates the selected state on drag-and-drop of node.
aria-level Indicates the level of node in TreeView.

Keyboard interaction

The TreeView functionalities can be interactive when keyboard shortcuts are used.

TreeView supports the following keyboard shortcuts.

Interaction Keys Description
Arrow Up Goes to the previous node.
Arrow Down Goes to the next node.
Arrow Right Expands the current node.
Arrow Left Collapses the current node.
Home Goes to the first node.
End Goes to the last node.
F2 Edits the focused node.
Esc Focuses out the edit state without saving the edited text.
Enter Selects the focused node/saves the edited text.
Space Checks the current node.
Ctrl + A Selects all nodes.