Skip to content

Add keyboard navigation to previews - #34

Merged
zhemingfan merged 1 commit into
mainfrom
feature/preview-keyboard-nav
Jul 4, 2026
Merged

Add keyboard navigation to previews#34
zhemingfan merged 1 commit into
mainfrom
feature/preview-keyboard-nav

Conversation

@zhemingfan

Copy link
Copy Markdown
Owner

Summary

Makes the table previews navigable from the keyboard — the third Tier 1 preview UX feature, after inline error decorations (#32) and in-preview find (#33).

Stacked on #33 (base feature/preview-find). Merge order: #32#33 → this. Retargets to main as each parent merges.

What's new

  • A shared useGridKeyboard hook tracks a focused {row, col} and maps:
    • ↑ / ↓ rows, ← / → columns
    • Home / End (row edges), Ctrl/Cmd+Home / End (first/last row)
    • PageUp / PageDown
    • Enter — activate (expand) the focused row
    • Escape — collapse an expanded row, else clear focus
  • The virtualized list scrolls to keep the focused row visible.
  • Keys are ignored while an input/textarea/select is focused, so navigation never fights the find box or filter dropdowns.

Wiring

  • VirtualTable (the table previews): focusable container, cell-level focus ring, Enter activates the row, clicking a row sets focus.
  • VcfPreview: focusable container, row-level focus ring, Enter toggles the row's expanded detail, Esc collapses.
  • Focus ring uses the theme --vscode-focusBorder.

Testing

  • useGridKeyboard.test.tsx — entry, movement + edge clamping, Home/End and Ctrl variants, paging, scrollToRow, Enter→activate, Escape clear-vs-consume, and the input-focus guard.
  • Full suite: 84 webview tests and 802 unit tests pass; lint, all type-checks, and the build are green.

Deferred (follow-ups)

  • Cell-level focus ring in the VCF preview (its cells are bespoke; row-level for now).
  • Horizontal auto-scroll on ← / →, and typeahead-to-row.

Make table previews navigable without a mouse. A shared useGridKeyboard hook
tracks a focused cell and maps arrow keys, Home/End, Ctrl/Cmd+Home/End,
PageUp/PageDown, Enter (activate), and Escape (collapse/clear) to focus moves,
scrolling the virtualized list to keep the focused row visible. Keys are ignored
while an input is focused so navigation never fights the find box.

VirtualTable gets a focusable container with a cell-level focus ring and
Enter-to-activate across the table previews; VcfPreview gets row-level focus with
Enter to expand and Escape to collapse. Includes tests for the navigation,
paging, activate/escape, scroll, and input-guard behaviours.
Base automatically changed from feature/preview-find to main July 4, 2026 01:51
@zhemingfan zhemingfan closed this Jul 4, 2026
@zhemingfan zhemingfan reopened this Jul 4, 2026
@zhemingfan
zhemingfan merged commit a797e43 into main Jul 4, 2026
3 checks passed
@zhemingfan
zhemingfan deleted the feature/preview-keyboard-nav branch July 4, 2026 02:06
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