Before submitting
Area
apps/web
Problem or use case
When keyboard focus is inside a Files, Diff, Browser, Plan, or Terminal surface in the right panel, pressing Cmd+W closes the T3 Code app window instead of closing the active panel tab.
T3 Code already binds mod+w to close a focused terminal, but there is no corresponding command or focus context for non-terminal right-panel surfaces. This is surprising for a tabbed interface and makes a common tab-closing shortcut destructive.
Proposed solution
Add a configurable rightPanel.closeActiveSurface command with a default mod+w binding gated by right-panel focus.
- Close only the active right-panel surface.
- Reuse the existing surface cleanup path so Browser and Terminal resources are disposed correctly.
- If another surface remains, activate the existing fallback surface.
- If the last surface closes, close the panel as it does today.
- Preserve the native window-close behavior when the right panel does not own focus.
- Ensure embedded Browser surfaces forward the shortcut to the app consistently.
Why this matters
Cmd+W is a standard close-tab shortcut. Applying it to the focused panel tab prevents accidental app-window closure and makes right-panel tabs behave consistently with terminal tabs and other desktop tabbed interfaces.
Smallest useful scope
Introduce one keybinding command and a right-panel focus context, then route it to the existing active-surface close callback. No new panel state, confirmation dialog, or queue of close actions.
Alternatives considered
- Add a hard-coded
keydown listener in the tab component. This bypasses T3 Code's configurable keybinding system and creates conflicts with the existing terminal binding.
- Always intercept
Cmd+W whenever the panel is visible. That would close a panel tab even when the user is actively typing in the chat composer.
- Keep native window close behavior. This remains surprising and risks losing the user's current window layout.
Risks or tradeoffs
- Focus detection must distinguish the right-panel terminal from the bottom terminal drawer.
- The new binding overlaps
terminal.close; right-panel focus must take precedence for a terminal hosted as a panel surface while drawer terminals keep their current behavior.
- Electron's native close accelerator and embedded Browser shortcut forwarding need to respect the renderer's handled state.
Examples or references
Related discoverability issue: #4146.
Contribution
Before submitting
Area
apps/web
Problem or use case
When keyboard focus is inside a Files, Diff, Browser, Plan, or Terminal surface in the right panel, pressing
Cmd+Wcloses the T3 Code app window instead of closing the active panel tab.T3 Code already binds
mod+wto close a focused terminal, but there is no corresponding command or focus context for non-terminal right-panel surfaces. This is surprising for a tabbed interface and makes a common tab-closing shortcut destructive.Proposed solution
Add a configurable
rightPanel.closeActiveSurfacecommand with a defaultmod+wbinding gated by right-panel focus.Why this matters
Cmd+Wis a standard close-tab shortcut. Applying it to the focused panel tab prevents accidental app-window closure and makes right-panel tabs behave consistently with terminal tabs and other desktop tabbed interfaces.Smallest useful scope
Introduce one keybinding command and a right-panel focus context, then route it to the existing active-surface close callback. No new panel state, confirmation dialog, or queue of close actions.
Alternatives considered
keydownlistener in the tab component. This bypasses T3 Code's configurable keybinding system and creates conflicts with the existing terminal binding.Cmd+Wwhenever the panel is visible. That would close a panel tab even when the user is actively typing in the chat composer.Risks or tradeoffs
terminal.close; right-panel focus must take precedence for a terminal hosted as a panel surface while drawer terminals keep their current behavior.Examples or references
Related discoverability issue: #4146.
Contribution