Keyboard Navigation

Focus model

The grid canvas must have DOM focus to receive keyboard events. Click on the canvas or use tab navigation to focus it.

ShortcutAction
Arrow keysMove selection by one cell
Shift + ArrowExtend selection in that direction
EnterStart editing the selected cell
EscapeCancel edit or clear selection
Ctrl+ZUndo
Ctrl+YRedo
Ctrl+CCopy selection
Ctrl+XCut selection
Ctrl+VPaste at selection anchor
Ctrl+FOpen search bar

MoveSelection command

Arrow key presses translate to MoveSelection:

state.apply(GridCommand::MoveSelection {
    delta_row: -1,  // up
    delta_col: 0,
    extend: false,  // true with Shift held
});
Keydelta_rowdelta_col
Up-10
Down+10
Left0-1
Right0+1

When extend is true, the anchor stays fixed and only the focus moves, expanding the selected range.

Editing via keyboard

  1. Enter or double-clickStartEdit
  2. Type the new value
  3. EnterCommitEdit
  4. EscapeCancelEdit

Event handling

The web layer (rs-grid-web) listens to keydown events on the canvas and converts them to GridCommand values. The browser's default behavior is prevented for handled keys to avoid scrolling or other unwanted actions.