From 2b07c4736e81fcaf0f4c8e7f661d6ec5180bad5c Mon Sep 17 00:00:00 2001
From: Jon Gunderson
A grid widget is a container that enables users to navigate the information or interactive elements it contains using directional navigation keys, such as arrow keys, Home , and End.
As a generic container widget that offers flexible keyboard navigation, it can serve a wide variety of needs.
@@ -2288,7 +2288,7 @@ WAI-ARIA Roles, States, and Properties
Grids : Interactive Tabular Data and Layout Containers
-
+
Table
If the number of widgets is large, replacing the table with a grid can dramatically reduce the length of the page tab sequence because a grid is a composite widget that can contain other widgets.
- As with other WAI-ARIA roles that have a native host language equivalent,
+ As with other WAI-ARIA roles that have a native host language equivalent,
authors are strongly encouraged to use a native HTML table
element whenever possible.
This is especially important with role table
because it is a new feature of WAI-ARIA 1.1.
It is thus advisable to test implementations thoroughly with each browser and assistive technology combination that could be used by the target audience.
@@ -2507,7 +2507,7 @@
NOTE: This design pattern is work in progress; it does not yet have task force consensus. - Progress and discussions are captured in + Progress and discussions are captured in issue 128.
@@ -2735,6 +2735,195 @@
+ A treegrid
can be used to present tabular information that has column titles, row titles, or both.
+ The grid
pattern is particularly useful if the tabular information is editable or interactive.
+ For example, when data elements are links to more information, rather than presenting them in a static table and including the links in the tab sequence, implementing the grid
pattern provides users with intuitive and efficient keyboard navigation of the grid contents as well as a shorter tab sequence for the page.
+ A grid
may also offer functions, such as cell content editing, selection, cut, copy, and paste.
+
+ In a grid, every cell contains a focusable element or is itself focusable, regardless of whether the cell content is editable or interactive. + There is one exception: if column or row 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 grid that are either not focusable or not used to label a column or row. +
++ A treegrid widget presents a hierarchical data that is presented as a data grid. + Any item in the hierarchy may have child rows, and rows that have children may be expanded or collapsed to show or hide the child rows. + For example, a hierarchical e-mail list uses a treegrid to display messages and responses to that message, + an item representing a message with responses can be expanded to reveal the response messages. +
+Terms for understanding treegrids include:
++ When using a keyboard to navigate a treegrid, a visual keyboard indicator informs the user which cell is focused. + If the treegrid allows the user 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 multi-select treegrids, which enable the user to select more than one item for an action, the selected state is independent of the focus. + For example, in a typical hierarchical e-mail grid, the user can move focus to select any number of e-mails 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. +
+ +tree
role supports the aria-activedescendant property,
+ which provides an alternative to moving DOM focus among treeitem
elements when implementing keyboard navigation.
+ For details, see Managing Focus in Composites Using aria-activedescendant.
+ tree
or referenced by an aria-owns property set on the tree
element.treeitem
that serves as a parent node has aria-expanded
+ set to false
when the node is in a closed state and set to true
when the node is in an open state.
+ End nodes do not have the aria-expanded
attribute because, if they were to have it, they would be incorrectly described to assistive technologies as parent nodes.
+ tree
has aria-multiselectable set to true
. Otherwise, aria-multiselectable
is either set to false
or the default value of false
is implied.true
for the selected node and it is not present on any other node in the tree.true
.false
.tree
has either a visible label referenced by aria-labelledby or a value specified for aria-label.tree
element is horizontally oriented, it has aria-orientation
+ set to horizontal
.
+ The default value of aria-orientation
for a tree is vertical
.
+ + If aria-owns is set on the tree container to include elements that are not DOM children of the container, + those elements will appear in the reading order in the sequence they are referenced and after any items that are DOM children. + Scripts that manage focus need to ensure the visual focus order matches this assistive technology reading order. +
+
From b82ebe9faacf1aeeb24fd16d0a1fe7a71bb917ad Mon Sep 17 00:00:00 2001
From: Jon Gunderson
- A
- In a grid, every cell contains a focusable element or is itself focusable, regardless of whether the cell content is editable or interactive.
- There is one exception: if column or row header cells do not provide functions, such as sort or filter, they do not need to be focusable.
+ 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 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 grid that are either not focusable or not used to label a column or row.
+ So, screen reader users may unknowingly overlook elements contained in a
- A treegrid widget presents a hierarchical data that is presented as a data grid.
- Any item in the hierarchy may have child rows, and rows that have children may be expanded or collapsed to show or hide the child rows.
- For example, a hierarchical e-mail list uses a treegrid to display messages and responses to that message,
- an item representing a message with responses can be expanded to reveal the response messages.
- Terms for understanding treegrids include:
- When using a keyboard to navigate a treegrid, a visual keyboard indicator informs the user which cell is focused.
- If the treegrid allows the user 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 multi-select treegrids, which enable the user to select more than one item for an action, the selected state is independent of the focus.
- For example, in a typical hierarchical e-mail grid, the user can move focus to select any number of e-mails for an action, such as delete or move.
+ When using a keyboard to navigate a
+ The following keys provide If a grid supports selection of cells, rows, or columns, the following keys are commonly used for these functions.
- If aria-owns is set on the tree container to include elements that are not DOM children of the container,
- those elements will appear in the reading order in the sequence they are referenced and after any items that are DOM children.
- Scripts that manage focus need to ensure the visual focus order matches this assistive technology reading order.
- WAI-ARIA Roles, States, and Properties
Treegrid
treegrid
can be used to present tabular information that has column titles, row titles, or both.
- The grid
pattern is particularly useful if the tabular information is editable or interactive.
- For example, when data elements are links to more information, rather than presenting them in a static table and including the links in the tab sequence, implementing the grid
pattern provides users with intuitive and efficient keyboard navigation of the grid contents as well as a shorter tab sequence for the page.
- A grid
may also offer functions, such as cell content editing, selection, cut, copy, and paste.
+ 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, a hierarchical e-mail discussion list uses a treegrid
to display messages and responses to that message, a message row with responses can be expanded to reveal the response messages.
treegrid
that are either not focusable or not used to label a column or row.
-
- treegrid
, a visual keyboard indicator informs the user which row or cell is focused.
+ If the treegrid
allows the user 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 multi-select treegrid
s, which enable the user 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, the user 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.
Treegrid
Examples
+
+ treegrid
Example with three types of focus navigation: Rows first, cells first and cells only interaction options.
Keyboard Interaction For Data Grids
+ 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 treegrid
s may not provide focus to rows.
+
+
+ aria-expanded
property it will will open or close the child rows, otherwise performs the default action for the cell.treegrid
widget to the next focusable control on the page.
+
+
+
+
+
+ treegrid
navigation keys move focus, whether the focus is set on an element inside the cell or the grid cell depends on cell content.
+ See Whether to Focus on a Cell or an Element Inside It.
+
+
+
+ Keyboard Interaction
+ WAI-ARIA Roles, States, and Properties
-
-
-
- treegrid
element or an element with role rowgroup. row
element and has one of the following roles:
-
-
-
-
-
-
+ row
with the aria-expanded state or that contains a gridcell
with the aria-expanded
state identifies the row as a parent row.
+ Set to aria-expanded
to false
when the child rows are in a closed state and set to true
when the child rows are in an open state.
+ End rows cannot have the aria-expanded
attribute because, if they were to have it, they would be incorrectly described to assistive technologies as parent nodes.
-
+
-
-
-
- treegrid
has aria-multiselectable set to true
. Otherwise, aria-multiselectable
is either set to false
or the default value of false
is implied.true
for the selected row or cell and it is not present on any other row or cell in the treegrid.
+
true
.false
.
-
- tree
role supports the aria-activedescendant property,
- which provides an alternative to moving DOM focus among treeitem
elements when implementing keyboard navigation.
- For details, see Managing Focus in Composites Using aria-activedescendant.
+ If there is an element in the user interface that serves as a label for the treegrid, aria-labelledby is set on the grid element with a value that refers to the labeling element.
+ Otherwise, a label is specified for the grid element using aria-label.
true
. true
on cells where editing is disabled.
+ If edit functions are disabled for all cells, aria-readonly
may be set true
on the grid element.
+ Grids that do not provide 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 grid and table properties.WAI-ARIA Roles, States, and Properties
-
-
tree
or referenced by an aria-owns property set on the tree
element.
- treeitem
that serves as a parent node has aria-expanded
- set to false
when the node is in a closed state and set to true
when the node is in an open state.
- End nodes do not have the aria-expanded
attribute because, if they were to have it, they would be incorrectly described to assistive technologies as parent nodes.
- tree
has aria-multiselectable set to true
. Otherwise, aria-multiselectable
is either set to false
or the default value of false
is implied.true
for the selected node and it is not present on any other node in the tree.
-
+ If the element with the true
.false
.treegrid
role is an HTML table
element, then it is not necessary to use ARIA roles for rows and cells because the HTML elements have implied ARIA semantics.
+ For example, an HTML <TR>
has an implied ARIA role of row
.
+ A 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
.
tree
has either a visible label referenced by aria-labelledby or a value specified for aria-label.tree
element is horizontally oriented, it has aria-orientation
- set to horizontal
.
- The default value of aria-orientation
for a tree is vertical
.
+ If rows or cells are included in a treegrid via aria-owns,
+ they will be presented to assistive technologies after the DOM descendants of the treegrid
element unless the DOM descendants are also included in the aria-owns
attribute.
If a grid supports selection of cells, rows, or columns, the following keys are commonly used for these functions.
A treegrid widget presents a hierarchical data grid consisting of tabular information that is editable or interactive.
From 9dfba29d5fbf2ae8f3cc2b288f6c77aef0492f2d Mon Sep 17 00:00:00 2001
From: Jon Gunderson Keyboard Interaction For Data Grids
aria-expanded
property it will will open or close the child rows, otherwise performs the default action for the cell.aria-expanded
property it will will open or close the child rows, otherwise performs the default action for the cell.
treegrid
widget to the next focusable control on the page.