@progress/wct-a11y-spec
Version:
Contains accessibility and keyboard navigation specification of Telerik and Kendo web components.
340 lines (206 loc) • 17.7 kB
Markdown
## Managing the Focus
The Grid component is a container that consists of 4 logically separated structural elements:
- Toolbar (`role="toolbar"`);
- Group header (`role="toolbar"`);
- Data Grid (`role="grid"`);
- Pager (`role="application"`);
Each of them is part of the page tab sequence and can be navigated to using the `Tab` key of the keyboard.
The `Toolbar` implements the keyboard navigation specification for a ToolBar component. Additionally, when the focus is on the search box, pressing the `Esc` key once clears the value, and pressing it a second time shifts the focus back to the ToolBar.
The `Group heder` implements the keyboard navigation specification for a ToolBar component. Delete buttons in the Field buttons should not be focusable. Deleting can be executed when Field name button is focused by pressing `Delete` or `Backspace`. After deleting a group (field button), the focus should be moved to the next field button (if present), or to the previous one. Upon deleting the last group (field button), the focus should be moved to the top-left data cell of the Grid.
The `Pager` implements the keyboard navigation specification for a Pager component.
The below description focuses only on the `Data Grid` part (the element with `role="grid"`) of the composite component.
## Data Grid Focus
The Data Grid is a single tab stop component. Upon focusing the Data Grid, the initial focus is set to either the previously focused cell (if any), or the first data (`<td>`) cell in the Data Grid. The change of the focused cell should be implemented using one of the following two techniques:
- Roving TabIndex components Practice for managing the focus. Meaning that going through the cells will update the tabindex of the cell.
- Active descendant - keeping the focus always on the Data Grid and using the `aria-activedescendant` on the Data Grid element which points to the id of the currently focused cell.
If a cell contains only one focusable element that does not itself require arrow keys for its inner navigation - focus goes to that element instead of its parent `<td>`.
If column header cells do not provide functions, such as sort, filter, grouping, or column menu, they may not be focusable.
If the Grid contains no items (empty Grid), the `No data` element in the Grid should be focused. That applies also for the scenario when the last item in the Grid has been deleted.
## Keyboard Shortcuts
### All Grid cells
| Shortcut | Behavior |
| -------- | -------- |
| `Right Arrow` | Moves focus one cell to the right (if any) |
| `Left Arrow` | Moves focus one cell to the left (if any) |
| `Down Arrow` | Moves focus one cell down (if any) |
| `Up Arrow` | Moves focus one cell up (if any) |
| `Home` | Moves focus to the first cell in the row that contains focus. |
| `End` | Moves focus to the last cell in the row that contains focus. |
| `Ctrl/Cmd(Mac) + Home` | Moves focus to the first (top-left) data cell in the grid. |
| `Ctrl/Cmd(Mac) + End` | Moves focus to the last cell in the last **loaded** row of the Grid. |
| `Page Down` | Loads and displays the next page of data. If virtual scrolling is used, scrolls down with the number of visible items. |
| `Page Up` | Loads and displays the previous page of data. If virtual scrolling is used, scrolls up with the number of visible items. |
| `Ctrl/Cmd(MacOS) + Down Arrow` | (Optional) Moves focus 5 rows down (if possible) or to the last row (for faster navigation). |
| `Ctrl/Cmd(MacOS) + Up Arrow` | (Optional) Moves focus 5 rows down (if possible) or to the first row (for faster navigation). |
### Grid data cells
#### All scenarios
| Shortcut | Behavior |
| -------- | -------- |
| `Enter` | When the grid is in InCell EditMode - EditMode is activated. In hierarchy cell - expands /collapses the detail row. In grouping cell - expands /collapses the group. If the cell contains a focusable elements - focus moves to the first focusable element inside. |
| `F2` | Puts the Grid in editing mode regardless of the configured type of editing. |
| `Delete` or `Backspace` | When the Grid is editable, triggers the default remove action for the respective Grid row. |
| `Esc` | If editor is opened, cancels the edit and closes the editor. If focus is on an element inside a cell, returns the focus back to the cell. |
#### In a row selection scenario
| Shortcut | Behavior |
| -------- | -------- |
| `Space` | Selects the row holding the currently focused cell. |
| `Ctrl + Space` or `Cmd + Enter`(MacOS) | Selects or deselects the current row, while persisting previously selected rows (only for selection mode "multiple"). |
| `Shift + Space` | Performs range selection, selects all the rows between the last selected one (with SPACE or mouse click) and the one holding the focused cell. |
| `Shift + Up Arrow` | Selects the row above. When multiple selection is enabled, extends the selection to that row. |
| `Shift + Down Arrow` | Selects the row below. When multiple selection is enabled, extends the selection to that row. |
#### In a cell selection scenario
| Shortcut | Behavior |
| -------- | -------- |
| `Space` | Selects the currently focused cell. |
| `Ctrl + Space` or `Cmd + Enter`(MacOS) | Selects or deselects the currently focused cell, while persisting previously selected cells (only for selection mode "multiple"). |
| `Shift + Space` | Performs range selection, selects all the cells between the last selected one (with SPACE or mouse click) and the focused cell. |
| `Shift + Up Arrow` | Selects the cell above. When multiple selection is enabled, extends the selection to that cell. |
| `Shift + Down Arrow` | Selects the cell below. When multiple selection is enabled, extends the selection to that cell. |
| `Shift + Left Arrow` | Selects the cell to the left. When multiple selection is enabled, extends the selection to that cell. |
| `Shift + Right Arrow` | Selects the cell to the right. When multiple selection is enabled, extends the selection to that cell. |
### Grid header cells
| Shortcut | Behavior |
| -------- | -------- |
| `Enter` | If sorting is enabled, Sort is applied. |
| `Alt` + `Down` | Opens the Column menu / Filter menu and moves focus to that menu. |
| `Esc` | Closes Filter or Column menu. |
| `Ctrl + Space` or `Cmd + Enter`(MacOS) | Group/ungroup the focused column. |
| `Ctrl/Cmd(Mac)` + `Left Arrow` | Reorders the column with the previous one. |
| `Ctrl/Cmd(Mac)` + `Right Arrow` | Reorders the column with the next one. |
| `Alt/Option(Mac)` + `Left Arrow` | Resizes the column (decreases width in LTR, increases width RTL). |
| `Alt/Option(Mac)` + `Right Arrow` | Resizes the column (increases width in LTR, decreases width RTL). |
Note that header cells can't contain arbitrary focusable elements if the Grid is sortable, as the `Enter` key is reserved for sorting. There should be an option to remap the `Enter` key if a user scenario requires focusable elements in the header.
### Command column cells
| Shortcut | Behavior |
| -------- | -------- |
| `Enter` | Moves focus inside the command column, and can trap the tab sequence. First button is focused. If a button is focused, triggers the button action. |
| `Esc` | If a button is focused, returns focus to the command cell. |
| `Tab` | Moves focus to the next button in the column. |
| `Shift + Tab` | Moves focus to the previous button in the column. |
When deleting Grid item (row) after focusing and pressing Enter on a `Delete` button, the focus should go to the cell in the same column on the next (if present), or the previous row (item).
### Grid Stacked Layout Mode Cells
#### Managing the Focus
The Grid cell receives focus like any other Grid cell. When user presses `Enter`, focus is moved within the cell content and the first item is focused. User can navigate through the internal elements using Tab and focus is trapped within the wrapper. `Escape` returns focus to the parent Grid cell (td element).
| Shortcut | Behavior |
| -------- | -------- |
| `Tab` | Moves the focus to the next "stacked cell" ('.k-grid-stack-cell' element). If the focus is on the last such item, the focus does not move further. |
| `Shift + Tab` | Moves the focus to the previous "stacked cell" ('.k-grid-stack-cell' element). If the focus is on the first such item, the focus does not move further. |
| `Enter` | If incell editing is enabled, opens the editor for the item. |
| `Esc` | If the focus is on content item wrapper, returns the focus to the Grid cell ('.k-table-td' element). If the focus is on an element inside a content item (for example cell editor), returns the focus back to the content item. |
### Inline Edit Row
Triggering an edit in Inline mode focuses the first editor.
| Shortcut | Behavior |
| -------- | -------- |
| `Tab` | Moves to the next editor in the row. |
| `Escape` | Cancels the row edit. The focus goes to the command cell from where the row edit was triggered. |
### Incell Edit Cell
When editing mode is incell, we have an excel-like navigation. When an editor is opened and focus is inside it, the following key combinations are in use.
| Shortcut | Behavior |
| -------- | -------- |
| `Tab` | Moves to the next editor in the row (closing current editor). It skips cells with `Editable='false'` and command columns. If focus is already on the last editable cell on the row, focus is moved to the first editable cell on the next row, and it's editor is opened. If we're already on the last row of the grid, focus remains on the cell, with the editor closed. |
| `Shift + Tab` | Moves to the previous editor in the row (closing current editor). It skips cells with `Editable='false'` and command columns. If focus is already on the first editable cell on the row, focus is moved to the last editable cell on the previous row, and it's editor is opened. If we're already on the first row of the grid, focus remains on the cell, with the editor closed. |
| `Enter` | Commits changes for the edited item, and moves focus to the same cell on the row below, opening it for edit. |
| `Escape` | Cancels the edit. The focus goes to the current cell. |
### Popup editor
Opening the popup editor focuses the first editor.
| Shortcut | Behavior |
| -------- | -------- |
| `Tab` | Moves to the next editor in the form. |
| `Escape` | Closes the editor. The focus goes to the command cell from where the popup was opened. |
| `Enter` | Triggers a submit action for the editor, including validation. |
#### Popup Editor Adaptive Mode
In adaptive mode, the Popup editor implements the ActionSheet specification with form-specific behavior. The Enter key maintains its form submission functionality rather than triggering the default ActionSheet action.
[ActionSheet specification]({{actionsheet_kb_link}})
| Shortcut | Behavior |
| -------- | -------- |
| `Enter` | Triggers a submit action for the editor form, including validation. |
### Filter Row
| Shortcut | Behavior |
| -------- | -------- |
| `Arrow Keys` | `td` elements receive focus as standard navigation in Grid. |
| `Enter` | Enters in the `td` and focuses the first focusable element in it. All filter row components gain `tabindex=0`. Focus remains trapped inside the filter row. |
| `Tab` | Goes through the filter row components. |
| `Esc` | Focus goes to the `td` element wrapping the currently focused filter component. |
### Column Menu
The Grid Column menu implements the Column menu keyboard navigation specification.
| Shortcut | Behavior |
| -------- | -------- |
| `Alt` + `Down Arrow` | Opens the ColumnMenu Popup when focus is on the Grid header cell or on the main column menu button. Focus is trapped and wrapped within the Popup. Focus is trapped within the Popup. |
Once opened, the Column Menu follows the Column Menu keyboard navigation specification:
[Column Menu specification]({{columnmenu_kb_link}})
### Filter Menu
The Filter menu implements the Filter menu keyboard navigation spec. After focusing the Filter menu, the focus is trapped within its contents. The user should not be allowed to tab-out of the menu.
| Shortcut | Behavior |
| -------- | -------- |
| `Alt` + `Down Arrow` | Opens the FilterMenu Popup when focus is on the Grid header cell or on the main filter menu button (depending on whether the Grid is navigable or not). Focus is trapped and wrapped within the Popup. |
| `Tab` | Navigates to the next focusable element in the Popup. If current focus is on the last element, moves focus to the first focusable item in the Popup. |
| `Shift` + `Tab` | Navigates to the previous focusable element in the Popup. If current focus is on the first element, moves focus to the last focusable item in the Popup. |
| `Enter` | For button items, executes the currently focused button action. |
| `Escape` | Closes the FilterMenu Popup and returns focus to the header cell or the main button. |
> All internal components follow their own keyboard navigation when focused.
### Toolbar Filter Tool
The Filter Tool in the Grid Toolbar provides quick access to column filtering options. When activated, it opens a popup containing filter options for all available columns. The popup implements the Column Menu keyboard navigation specification.
| Shortcut | Behavior |
| -------- | -------- |
| `Enter` or `Space` | Opens the Filter Tool popup when focus is on the filter button in the toolbar. Focus is moved to the first item in the popup and is trapped within the popup contents. |
Once opened, the Filter Tool popup follows the Column Menu keyboard navigation specification:
[Column Menu specification]({{columnmenu_kb_link}})
#### Filter Tool Adaptive Mode
In adaptive mode, the Filter Tool popup implements the ActionSheet specification as defined in the Column Menu component.
### Toolbar Sort Tool
The Sort Tool in the Grid Toolbar provides quick access to column sorting options. When activated, it opens a popup containing sort options for all available columns. The popup implements the Column Menu keyboard navigation specification.
| Shortcut | Behavior |
| -------- | -------- |
| `Enter` or `Space` | Opens the Sort Tool popup when focus is on the sort button in the toolbar. Focus is moved to the first item in the popup and is trapped within the popup contents. |
Once opened, the Sort Tool popup follows the Column Menu keyboard navigation specification:
[Column Menu specification]({{columnmenu_kb_link}})
#### Sort Tool Adaptive Mode
In adaptive mode, the Sort Tool popup implements the ActionSheet specification as defined in the Column Menu component.
### Toolbar Group Tool
The Group Tool in the Grid Toolbar provides quick access to column grouping options. When activated, it opens a popup containing grouping options for all available columns and management of existing groups. The popup implements the Column Menu keyboard navigation specification with additional reordering functionality for active groups.
| Shortcut | Behavior |
| -------- | -------- |
| `Enter` or `Space` | Opens the Group Tool popup when focus is on the group button in the toolbar. Focus is moved to the first item in the popup and is trapped within the popup contents. |
Once opened, the Group Tool popup follows the Column Menu keyboard navigation specification with these additional behaviors:
[Column Menu specification]({{columnmenu_kb_link}})
#### Group Management Actions
| Shortcut | Behavior |
| -------- | -------- |
| `Enter` | When focus is on an item, groups the column. |
#### Active Groups Reordering
When focus is within the active groups section, additional keyboard shortcuts are available for reordering:
| Shortcut | Behavior |
| -------- | -------- |
| `Up Arrow` | Moves the focused group item one level up in the grouping hierarchy. |
| `Down Arrow` | Moves the focused group item one level down in the grouping hierarchy. |
| `Enter` | Removes the focused column from the active groups. |
#### Group Tool Adaptive Mode
In adaptive mode, the Group Tool popup implements the ActionSheet specification as defined in the Column Menu component. The reordering functionality is maintained within the ActionSheet interface.
### Group row
| Shortcut | Behavior |
| -------- | -------- |
| `Enter` | Expands/Collapses the row |
### Detail Template master row
Detail template is accessed through the detail cell.
| Shortcut | Behavior |
| -------- | -------- |
| `Enter` | Toggles the detail template. |
| `Arrow Down` | Focuses the detailed cell. |
| `Enter` | If on detail cell, focus the first focusable element inside the detail template (if any). |
| `Esc` | Returns the focus to the detail cell. |
### Checkbox column
The CheckBoxes in a Checkbox column always receive focus instead of their `<td>` parents. That is because they are the only element in the cell, which is also focusable.
| Shortcut | Behavior |
| -------- | -------- |
| `Space` | Toggle checkbox. Toggling the checkbox selects/deselects a row. |
| `Esc` | Returns focus to the cell. |
### Row reordering column
#### Row reordering scenarios
The cells, containing the drag handles in a dedicated Row reordering column, allow row reordering when focused.
| Shortcut | Behavior |
| -------- | -------- |
| `Ctrl/Cmd(MacOS) + Shift + Down Arrow` | Reorders the row with the next one when such is present. |
| `Ctrl/Cmd(MacOS) + Shift + Up Arrow` | Reorders the row with the previous one when such is present. |
## Resources
[ARIA Authoring Practices: Grid Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/grid/)
[ARIA Authoring Practices: Data Grid](https://www.w3.org/WAI/ARIA/apg/patterns/grid/examples/dataGrids/)