Skip to content

Keyboard & accessibility ​

Keyboard navigation ​

Ctrl stands for ⌘ on macOS.

KeyAction
← → ↑ ↓move the focus (↑ / ↓ also focus group rows)
Ctrl + arrow keysmove the focus and add the cell to the selection (multi selection)
Tab / Shift + Tabnext / previous cell (wraps to the next row)
Page Up / Page Downone page up / down
Home / Endfirst / last cell of the row
Ctrl + Home / Endfirst / last cell of the grid
Shift + arrow keys, Page Up / Page Down, Home / Endextend the selection
Spacetoggle the selection of the row (row selection, Shift + Space selects a range) or start editing
Ctrl + Aselect all
Enterstart editing, expand / collapse tree rows which are not editable
F2start editing
any characterstart editing and replace the value with the typed character
Delete / Backspaceclear the editable cells of the selection (cell range, all cells of the selected rows or the focused cell)
Alt + ← / →collapse / expand tree rows
Ctrl + Ccopy the selection (clipboard)
Ctrl + Xcut: copy the selection and clear the editable cells
Ctrl + Vpaste at the focused cell
Ctrl + Zundo the last change (undo and redo)
Ctrl + Y / Ctrl + Shift + Zredo
Escapecancel column dragging or dragging the fill handle

Copy, cut and paste require the option clipboard, undo and redo the option undoRedo (both enabled by default). Delete, cut, paste and undo only change editable cells.

While editing ​

KeyAction
Enterfinish editing (with enterMovesDown: true the focus moves to the cell below, with Shift to the cell above)
Shift + Enternew line in a textarea editor
Tab / Shift + Tabfinish editing and edit the next / previous cell
Escapecancel editing

Group rows ​

When a group row (or a group footer) has the focus:

KeyAction
↑ / ↓previous / next row
→expand the group, move to the next row if it is expanded already
←collapse the group, move to the parent group if it is collapsed already
Enter / Spaceexpand / collapse the group
Home / Endfirst / last row of the grid

On a group footer the keys expand / collapse the group of the footer.

The focused cell always stays rendered and is scrolled into view.

Custom keyboard handling ​

Handle keys yourself with the onCellKeyDown callback and call preventDefault() to disable the default behavior:

vue
<Datagrid
  :events="{
    onCellKeyDown: (e) => {
      if (e.key === 'Delete') {
        e.preventDefault();
        deleteSelectedRows();
      }
    },
  }"
/>
tsx
<Datagrid
  events={{
    onCellKeyDown: (e) => {
      if (e.key === "Delete") {
        e.preventDefault();
        deleteSelectedRows();
      }
    },
  }}
/>

Accessibility ​

The grid follows the ARIA grid pattern:

  • role="grid" (treegrid for tree data and row grouping), row, columnheader, gridcell and rowgroup; toolbar, group area, pagination and status bar are outside of the grid element
  • aria-rowcount, aria-colcount, aria-rowindex, aria-colindex (also for virtualized rows)
  • aria-sort on sortable headers
  • aria-selected for selected rows and cells, aria-multiselectable
  • aria-expanded and aria-level for tree and group rows
  • the grid is one tab stop: Tab focuses the first cell (or the last focused cell), the arrow keys move the focus
  • editors are labelled with the header text of their column
  • aria-busy while loading
  • a roving tabindex: only the focused cell is part of the tab order
  • labels for checkboxes, toggle buttons and filter inputs (localized)

The demo pages of both adapters are checked with axe in the end-to-end tests (Chromium, Firefox and WebKit).

Touch devices ​

The grid can be used with the finger on phones and tablets:

GestureAction
Tapfocus and select a cell or row, sort a column, toggle checkboxes and groups
Swipescroll (with the inertia of the browser)
Double tapstart editing a cell, autosize a column (double tap on its resize handle)
Long press on a cellopen the context menu
Drag a handleresize a column, fill a range, drag a row
Long press on a header, then dragmove the column or drag it into the group area

On devices without a mouse the resize handles are wider and the menu buttons of the headers are always visible. A comfortable density makes rows easier to hit.

Cell ranges cannot be selected by dragging with the finger, because dragging scrolls the grid. With a keyboard attached, Shift + tap or Shift + arrow keys select a range.

Released under the ISC License.