Skip to content

fix: keep the zoom level of file: and other host-less pages across fragment navigations - #54381

Merged
codebytere merged 2 commits into
mainfrom
fix-zoom-key-without-fragment
Sep 26, 2026
Merged

codebytere merged 2 commits into
mainfrom
fix-zoom-key-without-fragment

Conversation

@codebytere

@codebytere codebytere commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Description of Change

Fixes #44526.

After this change a loadFile() page (or any URL without a host) keeps its zoom level across location.hash changes; today the next zoomIn/zoomOut after a hash change starts over from 100%.

HostZoomMap keys zoom levels by host, and by the full URL spec, fragment included, when there is no host. A hash change therefore moved the page to a new key: getZoomLevel() fell back to the default while the renderer kept the old zoom, and the next step was computed from the default. Pages with a host were never affected.

This carries the upstream fix, https://chromium-review.googlesource.com/c/chromium/src/+/8467669 (https://crbug.com/565900884), as a patch until it rolls in: the keying URL drops its fragment in the one helper every zoom call site uses, including Electron's WebContentsZoomController. A spec loads a file page, sets level 2, changes the hash and expects 2; main reads 0.

Checklist

Release Notes

Notes: Fixed the zoom level resetting on file: and other host-less pages after a location.hash change.

…agment navigations

HostZoomMap keys zoom levels for URLs without a host by their full spec,
including the fragment, so on a file: page a location.hash change moved
the page to a new key: getZoomLevel() dropped to the default while the
page kept its zoom, and the next zoom in/out was computed from the
default. Carry the upstream fix
(https://chromium-review.googlesource.com/c/chromium/src/+/8467669),
which strips the fragment from the keying URL.
@codebytere
codebytere requested a review from a team as a code owner September 25, 2026 13:26
@codebytere codebytere added semver/patch backwards-compatible bug fixes target/43-x-y PR should also be added to the "43-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. target/45-x-y PR should also be added to the "45-x-y" branch. labels Sep 25, 2026
@release-clerk

release-clerk Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Release note looks good now.

@codebytere
codebytere merged commit b947435 into main Sep 26, 2026
79 checks passed
@codebytere
codebytere deleted the fix-zoom-key-without-fragment branch September 26, 2026 10:49
@release-clerk

release-clerk Bot commented Sep 26, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed the zoom level resetting on file: and other host-less pages after a location.hash change.

@trop

trop Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "43-x-y", please check out #54440

@trop trop Bot removed the target/43-x-y PR should also be added to the "43-x-y" branch. label Sep 26, 2026
@trop

trop Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "45-x-y", please check out #54441

@trop

trop Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "44-x-y", please check out #54442

@trop trop Bot added in-flight/45-x-y in-flight/44-x-y and removed target/45-x-y PR should also be added to the "45-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. in-flight/43-x-y labels Sep 26, 2026
@trop trop Bot added merged/43-x-y PR was merged to the "43-x-y" branch. merged/45-x-y PR was merged to the "45-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. and removed in-flight/45-x-y in-flight/44-x-y labels Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

46-x-y merged/43-x-y PR was merged to the "43-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. merged/45-x-y PR was merged to the "45-x-y" branch. semver/patch backwards-compatible bug fixes

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

zoom level is reset on location.hash change

2 participants