Skip to content

fix(web): mod+w closes a side chat tab from inside the side chat - #28973

Open
zapagenrevdale wants to merge 1 commit into
pingdotgg:mainfrom
zapagenrevdale:fix/side-chat-mod-w
Open

zapagenrevdale wants to merge 1 commit into
pingdotgg:mainfrom
zapagenrevdale:fix/side-chat-mod-w

Conversation

@zapagenrevdale

Copy link
Copy Markdown

Problem

On desktop, pressing mod+w with focus inside a side chat (its messages or its composer) does nothing. The keybindings guide says mod+w "closes the focused terminal or the active right-panel tab", with no exception for side chats.

The main chat's window shortcut listener (useChatShortcuts) returned early for any key event inside [data-side-chat-pane]. The side chat itself only handles its composer chords, so rightPanel.close had no handler while a side chat had focus.

#26901 meant to keep thread-level commands out of the side chat ("Thread-level commands stay off in the side chat"). Panel shortcuts like mod+w were never discussed, so blocking them looks like a side effect of the catch-all guard, not intent. Shortcuts handled outside ChatView (sidebar toggle, new chat, mod+shift+t) already work from a side chat.

This is a small fix for an obvious bug: documented behavior missing in one focus state, one guard changed, no new behavior.

Fix

The main chat still ignores side-chat keys for type-to-focus and for every command except
rightPanel.close. Thread stop, r chords stay isolated as before.Thread-find Escape and paste-to-focus still skip the side chat.

Verification

  • Extended useChatShortcuts.browser.test.tsx with a case for focus in the side chat composer and the side chat messagd+w runs the parent'srightPanel.close and prevents default, that typing doesn't jump to the main composer, and
    that ctrl+shift+x doesn't stop thes fail on main (expected [] to deeply equal [ 'close' ]) and pass with the fix.
  • vp test run src/components/char.test.tsx: 9/9 pass.
  • vp run check:changed: format, lint, knip, typecheck, tests and the React compiler check
    all pass.
  • Manual, desktop dev (macOS): opened a side chat, clicked into its messages and its
    composer, pressed Cmd+W, and the ing stayed in the side chat.Recording below.

before: when side chat is focused, cant exit via mod+w unless tab for that chat session is clicked

before-trimmed.mp4

after: mod + w closes side chat on focus.

after-trimmed.mp4

Not checked:

  • Windows and Linux desktop. Ctrl+W goes through the same code path, but I only ran it on macOS.
  • Web with a rebound rightPanel.close (browsers reserve mod+w, per the keybindings guide). The fix covers any binding, and the test isn't tied to one, but I didn't try it in a real browser.

Written with Claude Opus 5.5 via t3code

The main chat ignored every key pressed in a side chat, so mod+w did nothing
on desktop. Let rightPanel.close through; other side-chat keys stay isolated.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T00:29:35.662932Z 6483c09 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 2, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 6483c09

Macroscope's review found this PR approvable — The existing close-tab shortcut now works from inside a side chat, while other parent-chat shortcuts remain blocked there. It reuses the established close behavior and safeguards, with no material new exposure identified.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between fa31b66 and 6483c09.

Files selected for processing: 3
  • apps/web/src/components/chat/useChatShortcuts.browser.test.tsx
  • apps/web/src/components/chat/useChatShortcuts.ts
  • apps/web/src/lib/sideChatPane.ts
Files with no reviewable changes: 1
  • apps/web/src/lib/sideChatPane.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

The chat shortcut handler now allows rightPanel.close from the side chat pane and ignores other commands there. Browser tests cover this behavior from the side-chat composer and message region.

Changes: Side-chat keyboard shortcuts

Layer / File(s) Summary
Filter shortcuts by side-chat focus
apps/web/src/components/chat/useChatShortcuts.ts, apps/web/src/lib/sideChatPane.ts
The handler skips type-to-focus handling when focus is in the side chat pane. It allows only rightPanel.close to proceed. A comment describing the previous behavior was removed; that file’s behavior is unchanged.
Cover side-chat shortcut behavior
apps/web/src/components/chat/useChatShortcuts.browser.test.tsx
The test wrapper accepts optional keybindings, commands, and children. Tests verify that mod+w invokes rightPanel.close from the composer and message region, while other tested shortcuts remain unhandled by the parent.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

  • pingdotgg/t3code#28905 — This issue concerns shortcuts in the side chat. The reported Cmd+F search shortcut remains unimplemented by this change.

Suggested reviewers: t3dotgg, juliusmarminge

Merge Risk: Minimal · up to 6483c

Side-chat closing and typing isolation have no identified merge-blocking issue.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: allowing mod+w to close a side chat tab from within the side chat.
Description check Passed The description covers the problem, expected behavior, fix, scope rationale, focused tests, manual verification, screenshots or recordings, and untested platforms. It contains several typographical an…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description covers the problem, expected behavior, fix, scope rationale, focused tests, manual verification, screenshots or recordings, and untested platforms. It contains several typographical and formatting errors, but it is sufficiently complete and directly related to the change.

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant