0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-03-31 23:31:30 -05:00

reset history title after push/replace but prior to assignment to location (#10605)

* reset history title after push/replace but prior to assignment to location

* add changeset
This commit is contained in:
Martin Trapp 2024-03-29 17:02:30 +01:00 committed by GitHub
parent e648c5575a
commit a16a829f4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
"astro": patch
---
Fixes an issue with outdated page titles in browser history when using text fragments in view transition navigation.

View file

@ -184,6 +184,7 @@ const moveToLocation = (
);
}
}
document.title = targetPageTitle;
// now we are on the new page for non-history navigations!
// (with history navigation page change happens before popstate is fired)
originalLocation = to;
@ -212,7 +213,6 @@ const moveToLocation = (
}
history.scrollRestoration = 'manual';
}
document.title = targetPageTitle;
};
function preloadStyleLinks(newDocument: Document) {