From bf391030877f130240ba6f20684e60c8a8ac67b4 Mon Sep 17 00:00:00 2001 From: jingsong-liu <10648096+jingsong-liu@users.noreply.github.com> Date: Sat, 18 Jul 2026 12:29:47 -0700 Subject: [PATCH] fix(desktop): accept shift modifier for keyboard zoom-in on macOS (#43517) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Surgical reapply of the surviving half of PR #43517 by @jingsong-liu (the branch predates the ts-ify migration; its other half — zoom restore after reload/navigation — landed via #66989). On US layouts Plus is physically Shift+=, so Cmd+Plus arrives with the shift modifier set. The blanket 'input.shift' early-return in installZoomShortcuts silently swallowed keyboard zoom-in on macOS: the chord matched neither branch and fell through to nothing. Shift is now evaluated per-chord: zoom-in accepts it, zoom-reset and zoom-out still reject it (Ctrl/Cmd+Shift+0 and Shift+'-' are different chords). --- apps/desktop/electron/main.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts index 2c15234beda1..f35e9efed95f 100644 --- a/apps/desktop/electron/main.ts +++ b/apps/desktop/electron/main.ts @@ -4967,19 +4967,31 @@ function installZoomShortcuts(window) { window.webContents.on('before-input-event', (event, input) => { const mod = IS_MAC ? input.meta : input.control - if (!mod || input.alt || input.shift) { + if (!mod || input.alt) { return } const key = input.key if (key === '0') { + if (input.shift) { + return // Ctrl/Cmd+Shift+0 is not a zoom chord — leave it alone + } + event.preventDefault() setAndPersistZoomLevel(window, 0) } else if (key === '=' || key === '+') { + // Zoom-in must accept the shift modifier: on US layouts Plus is + // physically Shift+=, so Cmd+Plus arrives as Cmd+Shift+'+' (or '=' + // depending on platform). The old blanket shift guard silently + // dropped keyboard zoom-in on macOS (#43517). event.preventDefault() setAndPersistZoomLevel(window, window.webContents.getZoomLevel() + ZOOM_STEP) } else if (key === '-') { + if (input.shift) { + return // Shift+'-' is '_' territory on most layouts, not zoom-out + } + event.preventDefault() setAndPersistZoomLevel(window, window.webContents.getZoomLevel() - ZOOM_STEP) }