Accessibility in Angular TreeView component
24 Jan 20245 minutes to read
The TreeView component followed the accessibility guidelines and standards, including ADA, Section 508, WCAG 2.2 standards, and WCAG roles that are commonly used to evaluate accessibility.
The accessibility compliance for the TreeView component is outlined below.
Accessibility Criteria | Compatibility |
---|---|
WCAG 2.2 Support | |
Section 508 Support | |
Screen Reader Support | |
Right-To-Left Support | |
Color Contrast | |
Mobile Device Support | |
Keyboard Navigation Support | |
Accessibility Checker Validation | |
Axe-core Accessibility Validation |
WAI-ARIA attributes
The TreeView component followed the WAI-ARIA patterns to meet the accessibility. The following ARIA attributes are used in the TreeView component:
Attributes | Purpose |
---|---|
role=tree |
All tree nodes are contained within the element. |
role=treeitem |
Specifies the role of each tree node in a selectable TreeView and its containment within the tree. |
role=group |
Specifies the role of each parent node container. |
role=checkbox |
Indicates checkbox control along with treeitem element. |
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. |
aria-checked |
Indicates the current checked state of TreeView checkbox. |
aria-label |
Indicates the contextual message for the TreeView checkbox. |
aria-activedescendant |
Identifies the currently active element when focusing on the TreeView. |
aria-disabled |
Indicates element is perceivable but disabled. |
Keyboard interaction
The TreeView component followed the keyboard interaction guideline, making it easy for people who use assistive technologies (AT) and those who completely rely on keyboard navigation. The following keyboard shortcuts are supported by the TreeView component.
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. |
Ensuring accessibility
The TreeView component’s accessibility levels are ensured through an accessibility-checker and axe-core software tools during automated testing.
The accessibility compliance of the TreeView component is shown in the following sample. Open the sample in a new window to evaluate the accessibility of the TreeView component with accessibility tools.