SpreadsheetGrid
Guides

Accessibility

Keyboard-only use, what screen readers hear, high contrast and reduced motion, and what to take care of in your app

The grid follows the WAI-ARIA grid pattern. It works with the keyboard alone, and moving the active cell makes screen readers read that cell. This page sums up what the grid does and what your app should add.

Keyboard

  • One Tab in, one Tab out. Buttons inside the grid (the header's ⋮, group row toggles, detail toggles) aren't in the Tab order; inside the grid you move with the arrow keys. Tab in the last column / Shift+Tab in the first column moves to the next / previous element outside the grid.
  • Header actions: Alt+↓ (Option+↓ on Mac) on the active cell opens the column menu of that column. Sorting, filters, pinning, autosizing and column visibility are all there.
  • Context menu: Shift+F10 / the Menu key (the application key on Windows) on the active cell opens the context menu of that cell (enableContextMenu) (since 1.1.0).
  • Expand and collapse: group rows and detail toggles use Enter / Space on the active cell. Rows of tree data use Alt+Shift+↓ (expand) / Alt+Shift+↑ (collapse) on a cell of the tree column (Enter edits, so it isn't used).
  • Popovers and menus: the column menu and context menu receive focus whether opened by mouse or key; arrow keys move between items and Escape / Tab closes them. In the column filter popover and the tool panel, Tab cycles inside; closing with Escape returns focus to the grid for the column filter, and to the part that opened it (such as the filter summary in the top bar) for the tool panel.
  • Where focus is: focus is shown by the outline of the active cell. When there is no active cell, as right after entering with Tab, an accent-colored (--ssg-accent) outline appears inside the table (not after touching it with the mouse).
  • Find and replace: Ctrl/Cmd+F in the grid (Ctrl+H to open the replace row as well) opens the find bar and moves focus to the search field. Enter / Shift+Enter goes to the next / previous match, and Tab moves through ↑ ↓ × → the replacement field → Replace → Replace all → "In selection". Enter in the replacement field replaces. Esc from anywhere in the bar closes it and returns to the grid. After returning to the grid with the bar still open, Ctrl/Cmd+F / Ctrl+H takes you back to the search field. When no match is left, the replace buttons only get aria-disabled and keep focus (Find in cells).
  • Page scrolling: moving the active cell with the keyboard also scrolls scrolling parents around the grid and the page as little as needed to bring the active cell into view.

The list of keys is in Keyboard and touch.

Actions only a pointer can do

The following can be done only with a mouse or touch. If keyboard-only users need them too, make your app's buttons do the same. Opening and closing column groups (columnGroups) works from the keyboard too (the "Collapse …" / "Expand …" item at the top of the column menu opened with Alt+↓ on the active cell).

Pointer actionWhat keyboard or your app's buttons can do instead
Context menu of a row number (target.type is 'rowHeader')Keys open only the active cell's menu (target.type: 'cell'), so also put row actions in the cell menu or in your app's buttons
Dragging a column width"Autosize this column" in the column menu. For a fixed width, applyState({ columnWidths }) from your app's button
Dragging to reorder columns (including the grip of column group headers)Reorder the columns you hold with onColumnsChange from your app's buttons
Pressing a column group header (columnGroups) to select its columns / dragging its right edge to resizeSelect the range of its columns with Shift+Arrow. Widths through applyState({ columnWidths }) from your app's button
Row drag (enableRowDrag)A button that calls the handle's moveRow
Fill handle (fillHandle)Copy (Ctrl/Cmd+C) and paste (Ctrl/Cmd+V)

Screen readers

  • Name of the table: give the table a name with ariaLabel. Always do so when you put several grids on one screen.

    <SpreadsheetGrid ariaLabel="Orders" rows={rows} columns={columns} />
  • Reading cells: the aria-activedescendant of the focused element points at the active cell, so assistive technology reads the cell every time you move with the arrow keys. Rows and columns not rendered because of virtualization aren't in the DOM, so the position within the whole table is conveyed with aria-rowindex / aria-colindex / aria-rowcount / aria-colcount.

  • Menus and panels: the column menu is role="menu" (named after the column), its items are menuitem, and the ascending / descending sort and "Pin column" items are menuitemradio + aria-checked. The header's ⋮ has aria-haspopup="menu" / aria-expanded. The context menu is role="menu" too, named "Cell menu" when opened on a cell and "Row menu" when opened on a row number (names since 1.2.0). The tool panel and column filter popover are named role="dialog" (non-modal) (roles of the column menu and tool panel since 1.1.0).

  • Tree data: with treeData, the table is role="treegrid"; rows get aria-level (top = 1) / aria-setsize / aria-posinset, and rows with visible children get aria-expanded. The toggle is named "Expand Sales" ("Expand Row 3" for rows with an empty name) (since 1.9.0).

  • Pagination: the pager is a <nav> (named 「ページ」 = text paginationLabel); the current page's number button has aria-current="page", and changing the page announces the row range 「51–100 / 1234 行」 in an invisible region (aria-live="polite"). aria-rowindex and row numbers are continuous across all pages. With several paginated tables on one screen, give each pager its own name with paginationLabel in localeText (for example "Order pages"). A pager you draw yourself with renderBottomBar isn't announced, so add your own aria-live (Pagination) (since 1.15.0).

  • Find bar: role="search"; match counts and replace notices are aria-live="polite" (repeated notices with the same text still reach the reader). The ▸ of the replace row has aria-expanded.

  • State: cells in the selection are aria-selected, cells that can't be edited are aria-readonly, the header of the first sort key is aria-sort, and loading rows (serverSide) are aria-busy.

  • Validation and notes: cells that fail validation are aria-invalid, and messages and notes (cellNote) are conveyed through aria-description (the same text as the tooltip). Unsaved cells of change tracking (trackChanges) also use aria-description, "Unsaved (was 120)", and rows with unsaved cells say "Has unsaved changes" in the row number's aria-description (Change tracking). The message when a 'reject' column can't be committed is role="alert" (Validation).

  • Diff view and range decorations: in the diff view (baseline of trackChanges), changed cells say "Changed (was 120)" in aria-description, added rows and changed rows say "Added row" / "Has changes" in the row number's aria-description, and removed rows are named "Removed row". The ▲ ▼ in the bottom bar are buttons named "Previous change" / "Next change", and where you land is announced in a hidden region (aria-live="polite") like "Unit price of P1: Changed (was ¥100) (1 of 3)". Removed rows also take a position in the view, so aria-rowindex counts them (Diff view). The frames and labels of range decorations (rangeDecorations) aren't read (aria-hidden); when a cell inside a range becomes active, the label is added to its aria-description (Range decorations) (both since 1.13.0).

  • Editors: the editor being used has a name such as "Edit Qty" and is conveyed as being inside the cell being edited (aria-owns). The select editor is a combobox and listbox (the search select's input is a combobox with aria-autocomplete="list", and options convey the total and their position with aria-setsize / aria-posinset; Searchable select editor).

  • Button names: every button the grid draws has a spoken name, such as the header's ⋮ ("Column menu for Qty"), row checkboxes ("Select row 3"), detail toggles ("Show details for row 3"; row number since 1.3.0) and group toggles ("Expand Tokyo"). The row drag handle and detail toggle columns keep an empty-looking header but are named "Move" / "Details" for screen readers (since 1.3.0; the texts rowDragColumnName / detailColumnName). The names above are the English texts of localeTextEn (English and text); without it, the default Japanese names are read.

The list of roles and attributes per element is in "Accessibility" in SpreadsheetGrid props.

Look

  • Reduce motion: the default motion="auto" stops animations when the OS / browser "reduce motion" setting (prefers-reduced-motion: reduce) is on. To always stop them, use motion="off" (Motion).
  • High contrast: where the browser replaces colors with system colors (forced-colors: active), such as Windows high contrast, parts that relied on color alone (invalid cells, note marks, unsaved marks, conditional format chips) are drawn with borders and symbols (Theming).
  • Contrast: among the default colors, secondary text such as in the tool panel doesn't reach WCAG AA's 4.5:1 (conditional format chips have been 5:1 or more in all 5 colors since 1.3.0). Token values to override to meet the standard are in "Raising contrast" in Theming.
  • Row height and padding: change row height and padding with density ('compact' / 'standard' / 'comfortable') and rowHeight. Make them roomier on screens where ease of pressing comes first.

What to take care of in your app

  • Buttons and links you place with renderCell need a name, either visible text or aria-label. The grid doesn't know their contents. Buttons in cells aren't stops for Tab in the last column, so if keyboard users need to press them, also put the row actions in a detail row card or in your app's buttons.
  • Custom editors (editor: { type: 'custom' }) need a name on their input, like the built-in editors (aria-label={`Edit ${title}`} and so on).
  • Don't convey meaning by color alone: when you color cells with cellClassName / getRowClassName to show a state, add text or a symbol too (the chips of conditional formatting show symbols by default).
  • A grid in a dialog: the grid's popups (column menu, filters, select options and so on) appear inside the dialog around the grid by default, so they work even when a modal traps focus (since 1.1.0; change the place with popupContainer; see Use it inside a dialog). The Escape the grid uses (cancelling an edit and so on) doesn't close the dialog; pressing it again does (Keyboard and touch).

Known limitations

  • With pinned columns (pinned), one row is split into a row (role="row") per left / center / right pane. They all have the same aria-rowindex, but the reading order is per pane.
  • The band of a detail row (detailRow) has no aria-rowindex (so data row numbers don't shift). The copy of a vertically pinned label row (labelRow.sticky) is aria-hidden, and the real label row is the one read.
  • While editing, checkers such as axe may report aria-required-children on the table. The editor is drawn outside the row and linked from the cell being edited with aria-owns, so in the browser's accessibility tree it's a child of the cell (checked in Chrome), but checkers count an element moved with aria-owns as a child of its original parent too.

On this page