Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes page titles in the browser's drop-down for back / forward navigation when using view transitions #9586

Merged
merged 4 commits into from
Jan 4, 2024

Conversation

martrapp
Copy link
Member

@martrapp martrapp commented Jan 2, 2024

Changes

The page titles displayed in the browser UI drop-downs for the history navigation were off by one because we call pushState() only after the DOM swap during view transitions.

One way to fix this would be to update the history before the swap. However, I prefer to keep history management and scroll restoration together as they are interdependent. And reaching the scroll target position may not be possible until after the swap.

Therefore, the original page title is now saved before the swap and used later when updating the history.

Testing

Manually tested.
No idea how to automatically test this.

Docs

n.a. bug fix

Copy link

changeset-bot bot commented Jan 2, 2024

🦋 Changeset detected

Latest commit: b680185

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added pkg: astro Related to the core `astro` package (scope) pr: docs A PR that includes documentation for review labels Jan 2, 2024
@martrapp martrapp changed the title Fixes titles in the browser's dropdown for back / forwards traversals through the browser history Fixes page titles in the browser's drop-down for back / forward navigation when using view transitions Jan 2, 2024
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@ematipico ematipico merged commit 82bad5d into main Jan 4, 2024
13 checks passed
@ematipico ematipico deleted the mt/title branch January 4, 2024 11:15
@astrobot-houston astrobot-houston mentioned this pull request Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope) pr: docs A PR that includes documentation for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants