Skip to content

Commit e7e3cee

Browse files
committed
Tree: Implement WAI-ARIA treegrid keyboard navigation
Update Tree accessibility to follow the WAI-ARIA treegrid pattern: Keyboard navigation changes: - Right arrow on cell 0: Expand collapsed row, or move to next cell - Left arrow on cell 0: Collapse expanded row, or stop if collapsed - Right/Left arrows: Navigate between cells and buttons within a row - Tab/Shift-Tab: Move between focusable elements (buttons, editable cells) in the current row, then exit tree when no more focusable elements - Up/Down arrows: Navigate between rows, maintaining column position - Arrow keys never exit the tree (always accepted) Focus model: - Cell-focused navigation (no row-level focus) for screen reader compatibility - Orca expects cells to have focus, not rows - row focus only announces expanded/collapsed state without cell content Accessibility improvements: - Use ROLE_TREE_GRID for multi-column trees - Use ROLE_ROW for tree items (instead of ROLE_TREE_ITEM) - Use ROLE_CELL for individual column cells - Use ROLE_COLUMN_HEADER for column titles - Hide column headers from accessibility tree when not visible - Parent buttons to row element (not cell) to prevent announcement clutter - Only set expanded/collapsed state on items with children - Set active_descendant on tree grid for screen reader focus tracking Reference: https://www.w3.org/WAI/ARIA/apg/patterns/treegrid/
1 parent 5b4cbd2 commit e7e3cee

File tree

5 files changed

+232
-58
lines changed

5 files changed

+232
-58
lines changed

doc/classes/DisplayServer.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2774,6 +2774,9 @@
27742774
<constant name="ROLE_TOOLTIP" value="45" enum="AccessibilityRole">
27752775
Tooltip element.
27762776
</constant>
2777+
<constant name="ROLE_TREE_GRID" value="46" enum="AccessibilityRole">
2778+
Tree grid element (tree with multiple columns).
2779+
</constant>
27772780
<constant name="POPUP_MENU" value="0" enum="AccessibilityPopupType">
27782781
Popup menu.
27792782
</constant>

drivers/accesskit/accessibility_driver_accesskit.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,6 +1640,7 @@ AccessibilityDriverAccessKit::AccessibilityDriverAccessKit() {
16401640
role_map[DisplayServer::AccessibilityRole::ROLE_COLUMN_HEADER] = ACCESSKIT_ROLE_COLUMN_HEADER;
16411641
role_map[DisplayServer::AccessibilityRole::ROLE_TREE] = ACCESSKIT_ROLE_TREE;
16421642
role_map[DisplayServer::AccessibilityRole::ROLE_TREE_ITEM] = ACCESSKIT_ROLE_TREE_ITEM;
1643+
role_map[DisplayServer::AccessibilityRole::ROLE_TREE_GRID] = ACCESSKIT_ROLE_TREE_GRID;
16431644
role_map[DisplayServer::AccessibilityRole::ROLE_LIST] = ACCESSKIT_ROLE_LIST;
16441645
role_map[DisplayServer::AccessibilityRole::ROLE_LIST_ITEM] = ACCESSKIT_ROLE_LIST_ITEM;
16451646
role_map[DisplayServer::AccessibilityRole::ROLE_LIST_BOX] = ACCESSKIT_ROLE_LIST_BOX;

0 commit comments

Comments
 (0)