Skip to content

fix: propagate tab-switch shortcuts from FreshClaude panes#173

Open
mvanhorn wants to merge 2 commits intodanshapiro:mainfrom
mvanhorn:osc/162-freshclaude-tab-switch-shortcut
Open

fix: propagate tab-switch shortcuts from FreshClaude panes#173
mvanhorn wants to merge 2 commits intodanshapiro:mainfrom
mvanhorn:osc/162-freshclaude-tab-switch-shortcut

Conversation

@mvanhorn
Copy link

Summary

  • ChatComposer now explicitly handles Ctrl+Shift+[ and Ctrl+Shift+] to dispatch tab switching
  • Matches the same pattern used by TerminalView's customKeyEventHandler
  • Provides defense-in-depth alongside the existing window-level listener in App.tsx

Fixes #162

Changes

  • src/components/agent-chat/ChatComposer.tsx: Added Ctrl+Shift+[/] handling in handleKeyDown that dispatches switchToPrevTab()/switchToNextTab()
  • test/unit/client/components/agent-chat/ChatComposer.test.tsx: Added 3 tests for tab-switch shortcut behavior

Test plan

  • npm run typecheck passes
  • All 20 ChatComposer unit tests pass (3 new)
  • Existing e2e test agent-chat-tab-shortcut-focus.test.tsx passes
  • Manual: Focus FreshClaude textarea, press Ctrl+Shift+[/] to verify tab switching

This contribution was developed with AI assistance (Claude Code).

ChatComposer now explicitly handles Ctrl+Shift+[ and Ctrl+Shift+]
to switch tabs, matching the pattern used by TerminalView. This
ensures tab switching works reliably when the FreshClaude textarea
has focus.

Fixes danshapiro#162
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3b10b55169

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +88 to +92
if (e.ctrlKey && e.shiftKey && !e.altKey && !e.metaKey) {
if (e.code === 'BracketLeft') {
e.preventDefault()
dispatch(switchToPrevTab())
return

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Stop duplicate tab-switch dispatch from chat composer shortcut

Dispatching switchToPrevTab()/switchToNextTab() here without stopping propagation causes the same keydown to be handled again by App’s window-level shortcut listener (src/App.tsx keyboard handler around lines 999-1004), because preventDefault() does not stop bubbling. In FreshClaude textareas this results in two tab-switch actions per keypress (e.g., with 2 tabs it appears to do nothing, with 3+ tabs it skips a tab), which is a functional regression introduced by this change.

Useful? React with 👍 / 👎.

preventDefault alone does not stop event bubbling - the keydown still
reaches App's window-level shortcut listener, causing two tab-switch
actions per keypress.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

Ctrl+Shift+Tab to switch tabs doesn't work when FreshClaude has focus

1 participant