The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 06:00 UTC
fix(web): Cmd+W closes the browser tab when the page has focus (#39340)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Ernest0N committed
Nov 20, 2026 at 01:21 UTC
296f9131f72cdc65fab7852e4b2d7709dcce0f7b
3 files changed
+23
-7
apps/web/src/components/ChatView.tsx
+14
-3
@@ -2832,15 +2832,26 @@ export default function ChatView(props: ChatViewProps) {
2832
},
2833
});
2834
2835
+ const closeActiveRightPanelSurfaceStable = useStableCallback(() => {
2836
+ if (activeRightPanelSurface) closeRightPanelSurface(activeRightPanelSurface);
2837
+ });
2838
+
2839
// A focused desktop browser page forwards these chords as menu actions.
2836
- // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to desktop bridge menu actions that toggle the right panel
2840
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to desktop bridge menu actions that toggle or close the right panel
2841
useEffect(() => {
2838
- if (embedded) return;
2842
+ if (embedded || backgroundThread) return;
2843
return window.desktopBridge?.onMenuAction((action) => {
2844
if (action === "rightPanel.toggle") toggleRightPanelStable();
2845
else if (action === "rightPanel.toggleMaximized") toggleRightPanelMaximizedStable();
2846
+ else if (action === "rightPanel.close") closeActiveRightPanelSurfaceStable();
2847
});
2843
- }, [embedded, toggleRightPanelStable, toggleRightPanelMaximizedStable]);
2848
+ }, [
2849
+ embedded,
2850
+ backgroundThread,
2851
+ toggleRightPanelStable,
2852
+ toggleRightPanelMaximizedStable,
2853
+ closeActiveRightPanelSurfaceStable,
2854
+ ]);
2855
2856
usePasteToFocusComposer(embedded ? null : activeThreadId, composerRef);
2857
// A delegated task is a remote thread's subagent.
apps/web/src/components/ReopenClosedViewShortcut.browser.test.tsx
+8
-4
@@ -265,14 +265,18 @@ describe("root reopen shortcut", () => {
265
expect(useClosedViewStore.getState().entries).toEqual([]);
266
},
267
);
268
- it("forwards address-bar focus and zoom from a focused desktop page", async () => {
268
+ it("forwards address-bar focus, zoom, and panel close from a focused desktop page", async () => {
269
setup();
270
await using _shortcut = await renderShortcut();
271
expect(state.setShortcuts).toHaveBeenLastCalledWith(
272
expect.arrayContaining(
273
- ["preview.focusUrl", "preview.zoomIn", "preview.zoomOut", "preview.resetZoom"].map(
274
- (command) => expect.objectContaining({ command }),
275
- ),
273
+ [
274
+ "preview.focusUrl",
275
+ "preview.zoomIn",
276
+ "preview.zoomOut",
277
+ "preview.resetZoom",
278
+ "rightPanel.close",
279
+ ].map((command) => expect.objectContaining({ command })),
280
),
281
);
282
});
apps/web/src/components/ReopenClosedViewShortcut.tsx
+1
@@ -54,6 +54,7 @@ const PREVIEW_FORWARDED_COMMANDS = [
54
"sidebar.toggle",
55
"rightPanel.toggle",
56
"rightPanel.toggleMaximized",
57
+ "rightPanel.close",
58
"preview.focusUrl",
59
"preview.zoomIn",
60
"preview.zoomOut",