Skip to content

WAI-ARIA support for Tree View #656

@mar10

Description

@mar10

https://www.w3.org/TR/wai-aria-practices-1.1/#TreeView

Keyboard Interaction:

  • On first load of the tree component, the top level node is in the tab order.
  • One and only one node of the tree component is in the tab order of the page at any time.
  • The last visited node in the tree control is retained in the tab order when the user navigates away from the tree control.
  • Arrowing to an item with the keyboard will focus and select the node. Any previous selections are cleared
  • Up Arrow and Down arrow keys move between visible nodes.
  • Left arrow key on an expanded node closes the node.
  • Left arrow key on a closed or end node moves focus to the node's parent.
  • Right arrow key expands a closed node, moves to the first child of an open node, or does nothing on an end node.
  • Enter key performs the default action on end nodes.
  • Typing a letter key moves focus to the next instance of a visible node whose title begins with that letter.
  • Home key moves to the top node in the tree view.
  • End key moves to the last visible node in the tree view.
  • Control + Arrow to an item with the keyboard focuses the item (but does not select it). Previous selections are maintained, provided that the Control key is not released or that some other keyboard function is not performed.
  • Control + Space with focus on an item toggles the selection of the item.
  • Shift + Up Arrow extends selection up one node.
  • Shift + Down Arrow extends selection down one node.
  • Shift + Home extends selection up to the top-most node.
  • Shift + End extends selection down to the last node.
  • *(asterisk) - on numeric keypad (optional) expands all siblings at the current node's level.

WAI-ARIA Roles, States, and Properties:

  • The tree view container has a role of tree.
  • Each node in a tree has the role treeitem and should be a DOM child of tree.
  • If is not a DOM child of tree, then it should be referenced by aria-owns from its logical parent node.
  • If all nodes in the tree are not DOM children of the tree, then set their aria-level, aria-setsize and aria-posinset accordingly; otherwise, this information cannot be computed for context by the user agent.
  • A collection of treeitems to be expanded and collapsed are enclosed in a group.
  • Each tree node which can be expanded should have aria-expanded set to false
  • Each tree node which is expanded should have aria-expanded set to true
  • Leaf nodes should not have aria-expanded set
  • If aria-multiselectable is set to true on the tree, then each selectable tree node should have aria-selected set to either true or false depending on the current selection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions