Accessibility
What was checked and how far is in the accessibility statement.
The structure screen readers read
The grid DOM uses the roles and attributes of the standard grid pattern.
| Element | Role and attributes |
|---|---|
| Grid root | role="grid", aria-rowcount, aria-colcount, aria-busy, aria-activedescendant pointing at the focused cell, aria-multiselectable for multiple selection |
| Header row, rows | role="row", aria-rowindex |
| Header cell | role="columnheader", aria-colindex, aria-sort while sorted |
| Data cell | role="gridcell", aria-colindex |
| Row-number cell | role="rowheader" |
| Selectable row | aria-selected="true" or "false" |
| Checkbox column | Cells use role="gridcell". The header checkbox has aria-checked (true, false, mixed) and a select-all aria-label |
| Empty data, loading | role="status" message |
aria-rowcount counts the header row too, and aria-busy follows the loading option. A sorted column's header carries aria-sort="ascending" or "descending". The priority number of a multi-sort is visual only and is not exposed to screen readers.
Loading and empty notices
The notice shown while loading or when no row is visible has role="status", so screen readers announce it. The grid root gets aria-busy="true" while the loading notice is shown. The placeholder rows of a skeleton (overlays.loading: 'skeleton') are aria-hidden, and the only text read is the loading message. How to change the look is in Data rows.
Tab order and DOM order
The grid root has tabindex 0 by default; change it with the tabIndex option (with -1 Tab does not enter the grid, only code or a click focuses it). Scrolling reuses row elements, so the DOM order can differ from the screen order. If your tools read in DOM order, turn on domOrder: 'screen'. Details are in Many columns.
Keyboard
In right-to-left layout (direction: 'rtl') ← and → swap meaning (← goes to the next cell). See Right-to-left layout.
The grid root holds the real DOM focus and names the current cell with aria-activedescendant. Row nodes are reused by virtual scrolling, so this keeps key input working while the user scrolls. Arrow keys, Tab, Home and End, PageUp and PageDown, Space, Enter, F2 and Esc are listed in Row selection and keyboard and Cell editing. When Tab reaches the last cell, the next Tab leaves the grid.
Leaving the grid with the keyboard
Since 1.8.0
tabNavigation and leaving with Esc are available since 1.8.0.
So that a big grid never traps keyboard users, Esc moves focus to the next element after the grid when nothing is being edited, no popup is open and nothing is being dragged; Shift+Esc moves it to the element before the grid. This is always on and needs no option. If an editor or menu is open, Esc closes it first.
The option tabNavigation decides what the Tab key does.
| Value | Tab and Shift+Tab |
|---|---|
'cells' (default) | Visits cells one by one. Tab on the last cell leaves the grid |
'exit' | The grid is one tab stop. Tab and Shift+Tab leave it at once, and the arrow keys move between cells |
createGrid(el, { columns, rows, rowKey: 'id', tabNavigation: 'exit' });Structure of popups and editors
Since 1.8.0
From 1.8.0 open popups and the cell editor fit the grid structure.
A role="grid" element only allows rows as children. So the filter menu, column menu, cell menu, value list, tooltip, toast and chart popup are put in a short-lived row > gridcell holder inside the grid, and the cell editor is wrapped in a row and cell with the same row and column index as the cell being edited. The holder takes no part in layout and disappears when the popup closes. Because of this, axe-core reports no aria-required-children violation while a popup or editor is open. Your app has nothing to do; just remember that if you search the inside of the grid with querySelector, a popup's parent is the holder.
Names and labels
- The name of a page-number button contains the visible number (for example "Page 2" in English, "페이지 2" in Korean, "ページ 2" in Japanese, "第 2 页" in Chinese), so voice control can say "click 2" (WCAG 2.5.3). The first, previous, next and last buttons show the symbols «, ‹, › and » and carry names such as "First page".
- A column with a header checkbox (
headerRenderer: 'checkbox') is read once. The checkbox carries the title as its name, so the visible title text is hidden from assistive technology. - On touch, the header filter and menu buttons and the group toggle are at least 24 px (WCAG 2.5.8).
- In
forced-colors(Windows high contrast) the tooltip, the toast, the selected filter-menu tab and the selected cells and rows in pinned columns keep readable text (1.8.0).
What was checked
For 1.8.0, key movement, open and close, overflow and alignment were checked automatically on all gallery examples. axe-core 4.14 and an accessibility-tree review ran on 10 key examples plus 5 states with a popup open (column menu, cell menu, tooltip, combobox editor, date picker). Those 15 states have no critical or serious violation (apart from items the example frame itself causes, such as document-title). Touch popups and bottom sheets were driven at 390 and 768 px in 42 cases. Not done yet: walking through with a real screen reader, a keyboard-only walk through every editor type, and real iOS and Android devices.
Color contrast
Text meets 4.5:1 in both light and dark themes, and focus rings and sort arrows meet 3:1. Modified cells, new rows and failed rows add a corner mark or a left bar to their color. An error cell shows the text ⚠ 오류 (⚠ Error with locale: 'en') in addition to its color, so the state does not depend on color alone. prefers-reduced-motion and forced-colors mode are handled too (see Theme).
Name the grid
Since 1.2.0
The ariaLabel option is available since 1.2.0. In 1.1.0 the grid itself cannot be given a name.
ariaLabel sets the name of the grid root (role="grid", or treegrid with a tree or groups). A screen reader reads it before the user enters the table. If a page has several grids, give each a different name.
const options = { columns, rows, rowKey: 'id', ariaLabel: 'Employees' };
api.setOptions({ ariaLabel: 'Former employees' }); // changes on the next screen update (almost at once)- Without a name, or with an empty string, no
aria-labelis set (the same as 1.1.0). - A value that is not a string raises
invalid-option. - The grid does not translate the name. It stays as you wrote it when
localechanges, so an app that switches language changes the name withsetOptionstoo.
Notices and toasts
showNotice and showCellToast create an element with role="status" (polite) or, for danger, role="alert" (immediate). They never take focus, and since nothing animates they behave the same under prefers-reduced-motion. See Notices and cell toasts.
What your app has to do
- Put a heading in front of the grid that says what it is, and give the grid itself a name with
ariaLabel(see "Name the grid" above, from 1.2.0). - If you use
cellClassorrowClassto mark a state with color, add text or an icon as well. - If you override theme variables, measure the contrast yourself.
- Do not offer selection or editing only through mouse-only buttons. Keyboard users need the same actions. Build a "delete selected" button as a real
buttonso it can take focus.