Read This First
No ARIA is better than Bad ARIA. Before using any ARIA, read this to understand why.
How to build accessibility semantics into web patterns and widgets
No ARIA is better than Bad ARIA. Before using any ARIA, read this to understand why.
A treegrid widget presents a hierarchical data grid consisting of tabular information that is editable or interactive.
Any row in the hierarchy may have child rows, and rows with children may be expanded or collapsed to show or hide the children.
For example, in a treegrid used to display messages and message responses for a e-mail discussion list, messages with responses would be in rows that can be expanded to reveal the response messages.
In a treegrid both rows and cells are focusable.
Every row and cell contains a focusable element or is itself focusable, regardless of whether individual cell content is editable or interactive.
There is one exception: if column header cells do not provide functions, such as sort or filter, they do not need to be focusable.
One reason it is important for all cells to be able to receive or contain keyboard focus is that screen readers will typically be in their application reading mode, rather than their document reading mode, when users are interacting with the grid.
While in application mode, a screen reader user hears only focusable elements and content that labels focusable elements.
So, screen reader users may unknowingly overlook elements contained in a treegrid that are either not focusable or not used to label a column or row.
When using a keyboard to navigate a treegrid, a visual keyboard indicator informs users which row or cell is focused.
If the treegrid allows users to choose just one item for an action, then it is known as a single-select treegrid, and the item with focus also has a selected state.
However, in a multi-select treegrid, which enables users to select more than one row or cell for an action, the selected state is independent of the focus.
For example, in a hierarchical e-mail discussion grid, users can move focus to select any number of rows for an action, such as delete or move.
It is important that the visual design distinguish between items that are selected and the item that has focus.
For more details, see this description of differences between focus and selection.
E-mail Inbox treegrid Example: A treegrid for navigating an e-mail inbox that demonstrates three keyboard navigation models -- rows first, cells first, and cells only.
The following keys provide treegrid navigation by moving focus among rows and cells of the grid.
Implementations of treegrid make these key commands available when an element in the grid has received focus, e.g., after a user has moved focus to the grid with Tab.
Moving focus into the grid may result in the first cell or the first row being focused.
Whether focus goes to a cell or the row depends on author preferences and whether row focus is supported, since some implementations of treegrid may not provide focus to rows.
aria-expanded property, opens or closes the child rows.,Otherwise, performs the default action for the cell.treegrid widget to the next focusable element.
treegrid navigation keys move focus, whether the focus is set on an element inside the cell or on the cell depends on cell content.
See Whether to Focus on a Cell or an Element Inside It.
If a treegrid supports selection of cells, rows, or columns, the following keys are commonly used for these functions.
See Key Assignment Conventions for Common Functions for cut, copy, and paste key assignments.
treegrid element or an element with role rowgroup.row element and has one of the following roles:
row that can be expanded or collapsed to show or hide a set of child rows is a parent row.
Each parent row has the aria-expanded state set on either the row element or on a cell contained in therow.
The aria-expanded state is set to false when the child rows are not displayed and set to true when the child rows are displayed.
Rows that do not control display of child rows do not have the aria-expanded attribute because, if they were to have it, they would be incorrectly described to assistive technologies as parent rows.
treegrid has aria-multiselectable set to true.
Otherwise, it is a single-select treegrid, and aria-multiselectable is either set to false or the default value of false is implied.
true on the selected row or cell, and it is not present on any other row or cell in the treegrid.true.false.true on cells where editing is disabled.
If edit functions are disabled for all cells, instead of setting aria-readonly to true on every cell, aria-readonly may be set to true on the treegrid element.
Treegrids that do not provide cell content editing functions do not include the aria-readonly attribute on any of their elements.
treegrid role is NOT applied to an HTML table element, then aria-rowspan or aria-colspan is applied as described in the
Grid and Table Properties Practice.
treegrid built from an HTML table that includes cells that span multiple rows or columns must use HTML rowspan and colspan and must not use aria-rowspan or aria-colspan.treegrid element unless the DOM descendants are also included in the aria-owns attribute.This is an unpublished draft preview that might include content that is not yet approved. The published website is at w3.org/WAI/.