Repository navigation
fix(desktop): make Cmd/Ctrl +/-/0 zoom the app window on every platform - #5737
Conversation
The desktop window never enabled page zoom. Tauri leaves zoom hotkeys off by default, so WebView2 on Windows had its zoom control disabled and macOS/Linux had no handler at all. The main window now enables Tauri's zoom hotkeys. WebView2 zooms natively; on macOS and Linux Tauri injects a keydown polyfill that calls set_webview_zoom. The dashboard is served from the loopback proxy, a remote origin to Tauri, so a new capability grants that one command to the main window for http://127.0.0.1:* only. A test pins the capability's window, origin and permission, and checks the pattern against the real dashboard URL.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
✅ Deterministic PR hygiene checks passed. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Repository: lidge-jun/opencodex/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
|
Maintainer-directed squash merge into |
Summary
The desktop window ignored the zoom shortcuts on every platform: Cmd +/-/0 on macOS and Ctrl +/-/0 on Windows and Linux did nothing. Tauri leaves zoom hotkeys off by default, so WebView2's zoom control was disabled on Windows, and macOS and Linux had no handler.
zoom_hotkeys_enabled(true). WebView2 zooms natively (keys and Ctrl+wheel). On macOS and Linux, Tauri injects its keydown polyfill (Cmd on macOS, Ctrl elsewhere, 20% steps,0resets), which callsset_webview_zoom.http://127.0.0.1:<port>/#/usage), which Tauri treats as a remote origin, so the polyfill's call would be refused without a grant. The newcapabilities/dashboard-zoom.jsongrants onlycore:webview:allow-set-webview-zoom, only to themainwindow, and only forhttp://127.0.0.1:*.default.jsonstill has noremoteentry, so the dashboard can reach no other command.structure/desktop-shell.mdnow documents this as the one exception to "the loopback dashboard reaches no command."Verification
cargo fmt --check,cargo clippy --all-targets -D warnings, andcargo testfordesktop/src-taurion macOS: 128 passed.tauri-buildaccepted the new capability, which it validates at compile time.window::tests::the_dashboard_reaches_only_the_zoom_commandfixes the capability's window, origin, and permission. It also parses the origin with Tauri's ownRemoteUrlPatternand checks that it matches the real dashboard URL while rejectinglocalhost,https,127.0.0.2, and unrelated hosts.bun run structure:checkandbun run privacy:scanpass.Checklist
Summary by CodeRabbit