Skip to content

fix(browser): restore configured zoom after page reload - #10800

Merged
OrcaWin merged 3 commits into
stablyai:mainfrom
luizeof:browser-feats
Jul 28, 2026
Merged

OrcaWin merged 3 commits into
stablyai:mainfrom
luizeof:browser-feats

Conversation

@luizeof

@luizeof luizeof commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Reapply the configured browser page zoom after every guest dom-ready event.
  • Keep zoom reset aligned with the configured default level.
  • Add unit and Electron E2E regression coverage for repeated normal and hard reloads.

Root cause

Chromium can restore per-origin zoom when an embedded page reloads. Orca only enforced its configured zoom when the webview was first created, so a native zoom value above 100% could survive subsequent reloads.

User impact

Embedded browser pages now return to the configured zoom after reload instead of retaining an unexpected zoom above 100%. Explicit non-default browser zoom settings remain respected.

Validation

  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/browser-pane — 31 files, 162 tests passed
  • Focused Electron E2E regression — 1 test passed across repeated normal and hard reloads
  • pnpm run typecheck
  • pnpm exec oxlint on changed files
  • pnpm exec oxfmt --check on changed files
  • pnpm run check:max-lines-ratchet

ELI5

After reloading a page in Orca's embedded browser, Chromium could restore an old zoom level instead of your configured one. This re-applies your preferred zoom after every page load so zoom stays consistent.

@luizeof
luizeof marked this pull request as ready for review July 26, 2026 23:00
@coderabbitai

coderabbitai Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Browser page zoom application now uses the configured default level for zoom adjustments and reapplies it on every guest dom-ready event. The initial-load-only flag was removed, and the displayed zoom percentage is updated from the applied level. Unit coverage verifies repeated restoration from a non-default zoom, while an E2E test verifies the default zoom persists across multiple reloads, including a cache-bypassing reload.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the change and validation, but it omits required template sections like Screenshots, Testing, AI Review Report, Security Audit, and Notes. Add the missing sections; if any do not apply, state that explicitly, and include the requested cross-platform review and security audit.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely summarizes the main change: restoring configured zoom after page reload.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker nwparker added the bug Something isn't working label Jul 27, 2026
luizeof and others added 3 commits July 27, 2026 18:21
Review fixes on top of PR stablyai#10800.

The dom-ready reassert used the shared browserDefaultZoomLevel, which zoom
in/out also writes. Two regressions followed:

- Cmd/Ctrl+0 reset became a fixed point: reset targeted the same value zooming
  had just written, so it could never return to 100%.
- Reloading a tab adopted a zoom the user applied to a *different* tab, since
  every pane reasserted the shared setting.

Keep the per-pane level in paneZoomLevelRef (seeded from the configured
default, moved only by zooming that pane) and reassert that on dom-ready.
Reset goes back to Chromium's 100%.

Also replaces the PR's unit test, which passed with the fix fully reverted,
with tests that model the pane/reload state machine and fail without the fix,
plus an e2e regression for the cross-tab case.
@OrcaWin

OrcaWin commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Reviewed with an independent reproduction. The bug is real and I confirmed it — on main a native zoom above 100% survives both normal and hard reload, and your dom-ready reapply does fix that.

But the fix as written was wired to the shared browserDefaultZoomLevel, which zoom in/out also writes to, and that introduced two regressions I confirmed with before/after screenshots in the running app:

  1. Cmd/Ctrl+0 reset became a no-op fixed point. Reset targets the value zooming just wrote, so a page stuck at 120% could never return to 100%.
  2. Reloading a tab silently adopted a zoom applied to a different tab.

Neither was caught by the new test — and this is the part worth internalizing: the unit test passed with the fix fully reverted, because it only exercises a module the PR doesn't change. A test that stays green when you delete the fix can't protect it.

Pushed to this branch: a per-pane zoom level seeded from the configured default and reasserted on dom-ready, so the reload behavior you wanted works without the shared-value coupling. Plus real E2E coverage in tests/e2e/browser-tab.spec.ts that drives the actual platform Cmd/Ctrl+0 chord into the guest webview and uses distinct origins to prove tab isolation.

I verified the new tests aren't vacuous the same way I found the original problem — reverted the rewrite while keeping the tests, and 2 of 3 failed exactly on Cmd/Ctrl+0 (got 0.5) and cross-tab isolation (got 1). Restored: 3/3 pass.

Validation: 167 browser-pane tests, 3 Playwright E2E, typecheck 0, oxlint clean.

Thanks for finding this — the per-origin zoom restore is genuinely non-obvious behavior and the diagnosis was right.

@OrcaWin
OrcaWin merged commit 60c7faf into stablyai:main Jul 28, 2026
22 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
Reviewed with an independent reproduction. Rewrote the reload-zoom reassert to be per-pane instead of sharing the value zoom in/out writes, fixing Cmd/Ctrl+0 reset and cross-tab zoom leakage, with E2E coverage proven to fail on revert.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants