@devries-cameron20 / t3code-1 / commits / ff1eead6f4
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): zoom shortcuts work while a desktop browser page has focus (#35947)

Julius Marminge committed Nov 12, 2026 at 20:34 UTC ff1eead6f411e02a23288236ad7b16d72ff8b147
5 files changed +32 -4
apps/desktop/src/preview/Manager.test.ts
+16 -1
@@ -820,7 +820,7 @@ describe("PreviewManager", () => {
820 ["linux", false],
821 ["win32", false],
822 ] as const)(
823 - "lets the page and its iframes claim the find shortcut before the host opens find on %s",
823 + "lets the page and its iframes claim the find and zoom shortcuts before the host acts on %s",
824 ([platform, usesMeta]) =>
825 withManager(
826 (manager) =>
@@ -838,8 +838,23 @@ describe("PreviewManager", () => {
838 yield* manager.registerWebview("tab_page_find", 42);
839 yield* manager.setForwardedShortcuts([
840 { command: "preview.find", shortcut: parseKeybindingShortcut("mod+f")! },
841 + { command: "preview.zoomIn", shortcut: parseKeybindingShortcut("mod+=")! },
842 ]);
843 const beforeInput = preview.listeners.get("before-input-event")!;
844 + const keepsZoom = vi.fn();
845 + beforeInput(
846 + { preventDefault: keepsZoom } as never,
847 + {
848 + type: "keyDown",
849 + key: "=",
850 + code: "Equal",
851 + meta: usesMeta,
852 + control: !usesMeta,
853 + shift: false,
854 + alt: false,
855 + } as never,
856 + );
857 + expect(keepsZoom).not.toHaveBeenCalled();
858 const findKey = {
859 type: "keyDown",
860 key: "f",
apps/desktop/src/preview/Manager.ts
+4 -1
@@ -444,6 +444,9 @@ type FindResultListener = (event: DesktopPreviewFindResultEvent) => Effect.Effec
444
445 const PAGE_FIRST_FORWARDED_COMMANDS: ReadonlySet<PreviewForwardedShortcut["command"]> = new Set([
446 "preview.find",
447 + "preview.zoomIn",
448 + "preview.zoomOut",
449 + "preview.resetZoom",
450 ]);
451
452 const decodePageShortcutKeys = Schema.decodeUnknownOption(
@@ -1553,7 +1556,7 @@ const makeNativeOperations = Effect.fn("PreviewManager.makeOperations")(function
1556 });
1557 if (forwarded && host) {
1558 // The page keeps these keys. Only the main-frame preload can report one it
1556 - // left unhandled, so a focused iframe (e.g. Google Docs' input) keeps its own find.
1559 + // left unhandled, so a focused iframe (e.g. Google Docs' input) keeps its own find or zoom.
1560 if (PAGE_FIRST_FORWARDED_COMMANDS.has(forwarded.command)) return;
1561 event.preventDefault();
1562 if (!input.isAutoRepeat) {
apps/web/src/components/ReopenClosedViewShortcut.browser.test.tsx
+6 -2
@@ -265,11 +265,15 @@ describe("root reopen shortcut", () => {
265 expect(useClosedViewStore.getState().entries).toEqual([]);
266 },
267 );
268 - it("forwards address-bar focus from a focused desktop page", async () => {
268 + it("forwards address-bar focus and zoom from a focused desktop page", async () => {
269 setup();
270 await using _shortcut = await renderShortcut();
271 expect(state.setShortcuts).toHaveBeenLastCalledWith(
272 - expect.arrayContaining([expect.objectContaining({ command: "preview.focusUrl" })]),
272 + expect.arrayContaining(
273 + ["preview.focusUrl", "preview.zoomIn", "preview.zoomOut", "preview.resetZoom"].map(
274 + (command) => expect.objectContaining({ command }),
275 + ),
276 + ),
277 );
278 });
279 });
apps/web/src/components/ReopenClosedViewShortcut.tsx
+3
@@ -50,6 +50,9 @@ const PREVIEW_FORWARDED_COMMANDS = [
50 "rightPanel.toggle",
51 "rightPanel.toggleMaximized",
52 "preview.focusUrl",
53 + "preview.zoomIn",
54 + "preview.zoomOut",
55 + "preview.resetZoom",
56 "preview.find",
57 ] as const;
58
apps/web/src/components/preview/PreviewView.tsx
+3
@@ -948,6 +948,9 @@ export function PreviewView({
948 // shortcuts from the guest as menu actions instead.
949 const unsubscribeMenu = window.desktopBridge?.onMenuAction((action) => {
950 if (action === "preview.focusUrl") onPreviewAction("focus-url");
951 + if (action === "preview.zoomIn") onPreviewAction("zoom-in");
952 + if (action === "preview.zoomOut") onPreviewAction("zoom-out");
953 + if (action === "preview.resetZoom") onPreviewAction("reset-zoom");
954 if (action === "preview.find") onPreviewAction("find");
955 });
956 return () => {