Adaptable

#Keyboard navigation

keyboardNavigation sets what the arrow keys move in the current view. It is separate from selection: a view can select rows and still move an active cell, or select nothing and still move around the grid.

It takes one of three values:

  • 'cell' — an active cell, highlighted with a border;
  • 'row' — an active row;
  • false — keyboard navigation is turned off.

When a view doesn't set it, it comes from viewDefaults.keyboardNavigation, and otherwise follows the selection mode: 'row' for 'single-row' and 'multi-row', 'cell' for 'multi-cell' and false. Set it explicitly to decouple the two:

Cell navigation with row selection
{
  id: 'multi',
  label: 'Multiple rows',
  selection: { mode: 'multi-row' },
  // move an active cell, even though rows are selected
  keyboardNavigation: 'cell',
};

The same three values apply to a flat table, a grouped table and a pivot view. Arrow keys move through the rows on screen, and a group row is a row they can land on. With 'cell', they move through the cells of those rows, including the cells of a group row and, on a pivot view, the aggregation columns.

The spacebar selects the active row when the view uses row selection. Which row that selects, and how shift and cmd/ctrl change it, is part of how users select rows.

#
Keyboard navigation

Click a cell, then use the arrow keys. The Cell navigation view moves an active cell, Row navigation moves an active row, and No keyboard navigation doesn't respond to the arrow keys.

open
loading demo…

#In the settings panel

The Selection & navigation settings page (id view-selection) sets the keyboard navigation of the current view, for table and pivot views: Cell, Row, None, or Automatic. Automatic removes keyboardNavigation from the view so it follows the selection mode again.

injectViewSelection() (the Angular counterpart of the useViewSelection hook) reads and sets it too: keyboardNavigation, keyboardNavigationAutomatic and setKeyboardNavigation ('auto' follows the mode), on the signal it returns. The rest of it is on the selection page.

keyboardNavigation is persisted with the view. Turning off selection.persist leaves it in the persisted state.