Skip to content

Keyboard navigation for sidebar file list (Tab to focus, arrows to move, Enter/Space to jump) #255

@IgorCandido

Description

@IgorCandido

Summary

Add true keyboard-driven sidebar file navigation, analogous to clicking a file in the sidebar with the mouse.

Currently, from reading src/ui/components/chrome/HelpDialog.tsx and the useAppKeyboardShortcuts wiring, the sidebar has:

  • Tab — toggle files ↔ filter focus state
  • / — focus the filter input
  • [ / ] — prev/next hunk (crosses file boundaries)
  • Mouse click on a file — jumps diff panel to that file's header

But there's no way, with focus in the "files" area, to move up/down the file list with the keyboard and activate a file. Tab toggles the focus flag but there are no arrow/j/k handlers bound while focusArea === "files", and no Enter/Space activation for the highlighted file. So practically the sidebar is mouse-only for file selection.

Requested behavior

  1. Tab (or dedicated key) puts focus in the sidebar file list, with a visible focused-row indicator.
  2. / (and ideally j / k) move the focused row in the sidebar without yet changing the diff pane.
  3. Enter or Space on the focused row activates that file — same effect as a mouse click: align the diff viewport to the top of that file's header (equivalent to jumpToFile(fileId, 0, { alignFileHeaderTop: true })).
  4. Tab again (or Esc) returns focus to the diff pane so all the existing diff-nav keys (], [, j, k, Space, etc.) resume working.

This would cleanly mirror the mouse flow — hover/click → jump — without needing the mouse, and is the natural companion to the filter (/) + Enter flow you already have.

Why it matters

Reviewers using tmux / terminal multiplexers / remote sessions / tiling WMs frequently can't or don't want to use the mouse. Multi-file reviews currently require either / + type-filename repeatedly, or walking every hunk with ] through files you don't care about. A sidebar that responds to keyboard focus + activation would make Hunk fully keyboard-first and significantly faster for large changesets.

Notes

  • Filed via Claude Code on behalf of a user dictating intent — feature request, not a bug report.
  • Verified against hunkdiff@0.10.0 installed via npm and against main source in this repo.
  • Thanks for building Hunk — it's already an excellent tool; hope this helps prioritize.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions