feat(desktop): page zoom for embedded browser (#1333) - #1509
Conversation
Add conversation-scoped page zoom for the embedded WebContentsView, independent of app shell zoom. Overflow menu gets a Codex-style Zoom row (− / percent / + / reset); keyboard and wheel/pinch when the page is focused use the same main-process path.
There was a problem hiding this comment.
Suggested priority: P2 (includes user-path files (packages/app/src/context/platform.tsx, packages/app/src/i18n/en.ts, packages/app/src/i18n/zh.ts, packages/app/src/pages/session/browser/browser-panel.tsx, packages/desktop-electron/src/main/browser/controller.ts, packages/desktop-electron/src/main/browser/logic.test.ts, packages/desktop-electron/src/main/browser/logic.ts, packages/desktop-electron/src/main/ipc/browser.ts, packages/desktop-electron/src/preload/index.ts)).
P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
💤 Files with no reviewable changes (3)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds embedded browser page zoom with clamped zoom math, per-conversation state, keyboard and menu controls, renderer-to-main IPC wiring, localized labels, and synchronization with Chromium WebContents. ChangesBrowser page zoom
Estimated code review effort: 3 (Moderate) | ~30 minutes Possibly related issues
Possibly related PRs
Sequence Diagram(s)sequenceDiagram
participant BrowserPanel
participant PreloadAPI
participant BrowserIPC
participant BrowserViewController
participant WebContents
BrowserPanel->>PreloadAPI: Request zoom action
PreloadAPI->>BrowserIPC: Invoke browser:zoom
BrowserIPC->>BrowserViewController: Forward target and action
BrowserViewController->>WebContents: Set zoom factor
WebContents-->>BrowserViewController: Emit zoom-changed
BrowserViewController-->>BrowserPanel: Publish zoomFactor state
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Keep conversation pageZoom as the only desired factor: step wheel/keyboard from that value, reassert on navigate and display claim/attach so origin- scoped Chromium zoom cannot desync the menu, drop dead format helper, and allow Shift+= for zoom-in.
Follow-up (Occam pass)Pushed
Contract residual: same-origin zoom is partition-scoped in Chromium. Reassert on show/navigate is the smallest fix without splitting the shared login partition. |
Shell zoom is pinned to 1, so zoomIn/Out/resetZoom only stole Cmd/Ctrl+/-/0 from the embedded browser before-input path. Page zoom stays in the browser overflow menu.
Contract + menu cleanupPushed after first-principles re-review:
Please re-check on macOS: page focused → |
Summary
First shippable slice of #1333: conversation-scoped page zoom for the embedded browser (
WebContentsView), independent of app shell zoom.Zoom+−/ percent /+/ circular resetCmd/Ctrl +/-/0while the embedded page is focusedzoom-changedon the page WebContents (sync + step fallback)Why
Users cannot enlarge page content without resizing the whole app or changing OS display scale. Existing
Cmd/Ctrl +/-/0only zooms the app shell, not the embedded page. This is the P1 first slice of the embedded-browser completion umbrella.Related Issue
Closes part of #1333 (page zoom only). Settings/full CDP, safe preview, and annotations remain follow-up PRs.
Human Review Status
Pending
Review Focus
setZoomFactoron the view’s WebContents only;computeViewBoundsstill uses window zoom).before-input-eventon the page when focused; shell shortcuts unchanged when the page is not focused.zoom-changedre-entrancy guard (applyingPageZoom) so programmaticsetZoomFactordoes not double-step.Risk Notes
zoom-changedsemantics; both “factor already applied” and “direction request” paths are handled. macOS desktop walkthrough confirmed by maintainer.How To Verify
Screenshots or Recordings
Maintainer verified live in
bun run dev:desktopon the PR branch (embedded browser overflow Zoom row + page zoom behavior).Checklist
enhancementapp,ui,platform,desktopP1Pending,Approved by @<reviewer>, orNot required: <reason>(default isPending; "not required" is restricted to bot-authored low-risk PRs).dev, and my PR title and commit messages use Conventional Commits in English.Summary by CodeRabbit
New Features
Bug Fixes