Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

@ammar-agent ammar-agent commented Oct 19, 2025

Summary

Pressing Cmd+2 (Ctrl+2 on Windows/Linux) while already on the Code Review tab now returns keyboard focus to the panel, enabling immediate keyboard navigation without clicking.

Implementation

Uses a simple prop trigger pattern:

  • RightSidebar increments focusTrigger counter when Cmd+2 is pressed on active Review tab
  • ReviewPanel watches trigger and calls .focus() on panel ref
  • Hunk selection is preserved (doesn't jump to first hunk)

Behavior

  • Cmd+1: Switch to Costs tab
  • Cmd+2: Switch to Review tab (or refocus if already active)
  • j/k/↑/↓: Navigate between hunks (after panel has focus)
  • m: Toggle hunk read/unread
  • Space: Expand/collapse hunk

Why This Matters

Code review with keyboard is faster when you can instantly return focus from chat input to the review panel. Previously, you had to click on the panel or tab through UI elements.

Generated with cmux

When user presses Cmd+2 (or Ctrl+2 on Windows/Linux) while already viewing
the Code Review tab, the keybind now focuses the panel and selects the first
hunk for easier keyboard navigation.

Implementation uses a simple prop trigger pattern:
- RightSidebar maintains focusTrigger counter state
- Incrementing the counter triggers ReviewPanel to focus first hunk
- Declarative approach avoids forwardRef/useImperativeHandle complexity

This makes keyboard-driven code review workflows smoother - users can
quickly jump to the first hunk without needing to click or use j/k navigation
from an arbitrary scroll position.
Changed Cmd+2 behavior when already on Review tab to only focus the panel
without modifying the selected hunk. This preserves user's position in the
review and allows keyboard navigation to resume from where they left off.
@ammar-agent ammar-agent changed the title 🤖 Enhance Cmd+2 to focus first hunk when already on Review tab 🤖 Cmd+2 returns focus to Review tab Oct 19, 2025
@ammario ammario added this pull request to the merge queue Oct 19, 2025
Merged via the queue into main with commit 41ed015 Oct 19, 2025
8 checks passed
@ammario ammario deleted the cmd-tab-keybinds branch October 19, 2025 23:00
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.

2 participants