Skip to content

fix(desktop): limit zoom handler to zoom keys#25516

Merged
Hona merged 4 commits intoanomalyco:devfrom
Hona:fix/desktop-zoom-ownership
May 3, 2026
Merged

fix(desktop): limit zoom handler to zoom keys#25516
Hona merged 4 commits intoanomalyco:devfrom
Hona:fix/desktop-zoom-ownership

Conversation

@Hona
Copy link
Copy Markdown
Member

@Hona Hona commented May 3, 2026

Summary

  • Only handle actual zoom shortcuts in the Electron renderer zoom keydown listener.
  • Stop unrelated Ctrl/Cmd hotkeys from re-sending the current zoom factor.
  • Leave Electron native menu zoom roles and wheel/pinch behavior unchanged.

Testing

  • bun typecheck in packages/desktop-electron
  • pre-push bun turbo typecheck

Copilot AI review requested due to automatic review settings May 3, 2026 02:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and preventDefault() 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 on zoom-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)
@Hona Hona changed the title fix(desktop): keep zoom state renderer-owned fix(desktop): limit zoom handler to zoom keys May 3, 2026
@Hona Hona enabled auto-merge (squash) May 3, 2026 02:41
@Hona Hona merged commit b4cc7d1 into anomalyco:dev May 3, 2026
10 checks passed
oleksii-honchar pushed a commit to oleksii-honchar/better-opencode that referenced this pull request May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants