A data grid presents tabular information with spreadsheet-like interaction: users move between cells in two dimensions, typically with arrow keys. Choose a grid when that navigation is needed; for reading or review, a native table is usually enough, even if it includes sorting, filtering, or interactive controls. section 6.2
Start with native table elements to preserve relationships between headers and data cells. Add role="grid" to communicate spreadsheet-like interaction to assistive technology. The role does not provide keyboard behavior: implement, test, and maintain keyboard navigation and focus management. section 6.2 section 6.2.2
Table 6.3 Outline of keyboard operations typically expected on a grid interactive widget
|
Group
|
Keys
|
Expected
behavior
|
|
Navigation
|
Arrow keys, Home, End, Ctrl+Home, Ctrl+End, Page Up, Page Down
|
Arrow keys move focus between cells in two dimensions. Home and End move to the beginning or end of a row, while Page Up and Page Down move focus up or down a predetermined number of rows (especially
useful with large grids). Ctrl+Home and Ctrl+End move focus to the first cell in the first row or the last cell in the
last row, respectively.
|
|
Editing and interaction *
|
Enter, F2, alphanumeric keys, Escape, Tab, Shift+Tab, Arrow keys and Space
|
Enter cell interaction (or editing) mode with Enter or F2, and switch back to grid navigation using Escape (canceling any
edits) or F2. If the cell contains more than one widget, the first widget receives
focus. Pressing Enter again when a cell contains a single-line text field updates the value
and restores grid navigation. Alphanumeric keys may begin editing directly. Tab and Shift+Tab move focus to the next or previous interactive element while using
the grid. Space activates any associated control, such as checkboxes or buttons.
|
|
Selection *
|
Ctrl+Space, Shift+Space, Ctrl+A, Shift+Arrow keys
|
Select an entire column or row that currently contains focus using Ctrl+Space or Shift+Space, respectively. Ctrl+A selects all cells in the grid, while Shift+Arrow keys extend selection one cell to the right (Shift+Left), right (Shift+Right), up (Shift+Up), and down (Shift+down).
|
|
Entering and leaving the grid
|
Tab, Shift+Tab
|
Moves focus into or out of the grid. Only one focusable element, such
as a cell, is included in the page sequence. If a cell was focused before
leaving the grid, it regains focus when the user re-enters the grid.
|
|
* These behaviors are optional
|
||
Use these typical keyboard operations to plan grid navigation and cell interaction. section 6.2
On narrow screens or at high zoom, a grid may need horizontal scrolling. Contain that scrolling within the grid rather than making the whole page scroll in two dimensions; avoid shrinking text or columns to force a fit. section 6.2.1

