fix(desktop): preserve UI scale across hash-route navigation - #75015
clarkvines wants to merge 1 commit into
Conversation
|
Thanks — this is a focused fix for an unfixed hash-navigation restoration gap. Current main restores zoom on The extracted helper preserves the existing persisted-state funnel, scopes the action to main-frame navigation, and retains the existing window-kind zoom opt-out. The unit coverage and Cmd/Ctrl+N Electron E2E exercise the relevant lifecycle path. No blocking problems found. Automated hermes-sweeper review. |
|
version 0.20.0 |
|
Superseded by #94396 — thanks for finding this one, @clarkvines. Your diagnosis of the mechanism was right, and the fix in #94396 is your Two things changed on top of it: It isn't macOS-specific. This PR described it as "Chromium resets file:// zoom to level 0 on hash-route navigation on macOS." The cause is Chromium's per-URL zoom store, and it reproduces on Windows — confirmed on real Electron 40.10.2 / Chromium 144 (win32), where a hash route with no zoom record reports 100% at The E2E now drives the reported path. The Cmd+N case is kept, but the primary test navigates to routes Chromium holds no record for, which is what opening a new session actually looks like to the per-URL store. Worth noting for anyone reading later: the |
Bug Description
Desktop UI scale can reset to 100% when an action changes the in-page hash route. One visible path is Cmd/Ctrl+N from Settings after selecting a non-default scale.
Fixes #38854
Fixes #48658
Related: #38908, #43517, #66989
Root Cause
Packaged Desktop loads the renderer from a
file://URL and uses hash routing. Electron can resetwebContentszoom to level 0 during main-frame hash navigation. The existingdid-finish-loadrestoration does not run for these in-page navigations.Fix
did-navigate-in-pageevents.webContents.Scope
This change addresses resets caused by main-frame hash navigation. Startup persistence and renderer-state synchronization remain separate zoom paths and are unchanged by this PR.
How to Verify
Test Plan
Risk Assessment
Low — the production change only reasserts the already-persisted zoom level after a main-frame navigation event. Existing clamping, persistence, renderer notification, and window-specific wiring remain unchanged.