Bugfixes for back navigation in the view transition client-side router #8491
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
L266 + L351: This fix was mainly triggered by a bug I introduced with 3.0.11: backward navigation was no longer possible when starting from a history state that was not pushed by the CSR (e.g. navigate to a #fragment on a VT page and navigate to another page from there).
Other change: the handling of self links used to call pushState, so you would have that jump in the history as well. But that doesn't really work, because we would do transitions at history navigation. (in popstate it is not possible to see if we have been on the same page before, otherwise we could prevent transitions for those).pushState is required for the self-link to update the browser's address bar. So I have reintroduced it. In popstate, the navigation of self-links is now detected by negative values for scrollY. This way, the history navigation for self-links can be filtered and the scroll position can be updated without starting view transitions.
+ Improvement of the comment that describes the reload of the CSR.
Testing
added e2e test for back navigation after transition form position navigated to by #fragment URL.
Docs
n/a bug fix