fix(desktop): limit zoom handler to zoom keys#25516
Merged
Hona merged 4 commits intoanomalyco:devfrom May 3, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Routes desktop zoom behavior through the renderer-controlled zoom signal/IPC bridge so menu/keyboard/wheel zoom actions no longer rely on Electron’s native zoom roles and don’t race Chromium’s built-in zoom behavior.
Changes:
- Added renderer-owned zoom helpers (
zoomIn/zoomOut/zoomReset), clamping, initial zoom sync, andpreventDefault()handling for keyboard + ctrl/meta wheel zoom. - Routed macOS menu zoom items to
deps.trigger("zoom.*")instead of Electron zoom roles, and handled those commands in the renderer. - Disabled Chromium “visual zoom” in the main process via
setVisualZoomLevelLimits(1, 1)(instead of resetting zoom back to 1 onzoom-changed).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/desktop-electron/src/renderer/webview-zoom.ts | Adds exported zoom actions, clamps/syncs zoom, and prevents native keyboard/wheel zoom from racing renderer state. |
| packages/desktop-electron/src/renderer/index.tsx | Handles incoming menu zoom commands by calling renderer zoom helpers. |
| packages/desktop-electron/src/main/windows.ts | Replaces zoom-changed reset with disabling Chromium visual zoom limits. |
| packages/desktop-electron/src/main/menu.ts | Replaces Electron zoom roles with menu items that trigger renderer commands. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }) | ||
| // Let renderer-owned zoom handle keyboard/menu changes without Chromium's | ||
| // visual zoom path racing it back to 1. | ||
| void win.webContents.setVisualZoomLevelLimits(1, 1).catch(() => undefined) |
Comment on lines
+26
to
+27
| setWebviewZoom(clamped) | ||
| void window.api.setZoomFactor(clamped).catch(() => undefined) |
66 tasks
oleksii-honchar
pushed a commit
to oleksii-honchar/better-opencode
that referenced
this pull request
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing