Skip to content

refactor(datagrid): Phase 3 keyboard interaction cleanup#952

Merged
datlechin merged 11 commits intomainfrom
refactor/datagrid-phase3-interaction
Apr 30, 2026
Merged

refactor(datagrid): Phase 3 keyboard interaction cleanup#952
datlechin merged 11 commits intomainfrom
refactor/datagrid-phase3-interaction

Conversation

@datlechin
Copy link
Copy Markdown
Member

Summary

DataGrid Phase 3 — full keyboard interaction refactor. Removes shadow handlers and custom reimplementations of NSTableView built-ins.

Key changes:

  • Remove Ctrl+HJKL Vim navigation (shadowed system text editing actions deleteBackward/insertNewlineIgnoringFieldEditor/deleteToEndOfLine/centerSelectionInVisibleArea)
  • Remove custom Shift+Up/Down arrow handlers (NSTableView native handles range selection via moveDownAndModifySelection: et al)
  • Remove custom Home/End/PageUp/PageDown handlers (NSTableView native via interpretKeyEvents)
  • Remove orphaned selectionAnchor/selectionPivot state (NSTableView manages internal anchor)
  • Add focusedRow sync after native row navigation in tableViewSelectionDidChange
  • Remove redundant DataChangeManager.undoLastChange/redoLastChange public API (production uses window.undoManager via responder chain)
  • Update audit doc with Phase 3 status + per-issue annotations

Net delta: -250 lines

Why

Audit re-evaluated. Most Phase 3 audit issues found to be already correct in current code (Phase 1/2 era fixes). Real Phase 3 changes:

Already correct (no changes): #6, #10, #11, #13, #14, #16, #23, #32, #33, #35.

See docs/development/datagrid-audit.md Phase 3 Status section.

Behaviors preserved

  • Tab/Shift+Tab cell navigation (NSTableView has no native cell-by-cell)
  • Left/Right arrow column focus (NSTableView is row-oriented)
  • Return/Enter triggers inline edit
  • FK preview keyboard shortcut (configurable)
  • Escape cancels active edit (does NOT deselect rows)
  • focusedRow/focusedColumn separate from row selection (TablePlus pattern)

Test plan

  • xcodebuild test (user runs locally; SIGTERM in CI is pre-existing test infra issue unrelated to this PR)
  • swiftlint lint --strict
  • Manual: Up/Down arrows move selection by 1 row
  • Manual: Shift+Up/Down extends selection
  • Manual: Home jumps to row 0, End jumps to last row
  • Manual: Page Up/Down scrolls one page
  • Manual: Tab/Shift+Tab navigate cells
  • Manual: Cmd+Z/Cmd+Shift+Z undo/redo via menu bar
  • Manual: Multi-cell paste (5x3 grid into smaller-than-table region)
  • Manual: Ctrl+H during cell edit deletes character backward (not column nav)
  • Manual: Right-click on active edit shows row context menu

@datlechin datlechin merged commit a972675 into main Apr 30, 2026
2 checks passed
@datlechin datlechin deleted the refactor/datagrid-phase3-interaction branch April 30, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant