The "Morph" transition only works with browsers that natively support view transition API.
Hash change link with parameters to same page
Normally, navigation to a hash target on the current page won't trigger view transitions. The recipe for get intra-page view transitions is as follows:
?vt
to the intra-page URL, thus forcing view transitions
and events.
astro:before-preparation
listener: redefine the loader()
to do
nothing
astro:before-swap
listener: redefine swap()
to do nothing (besides
removing old instances of .astro-route-announcer
)
astro-before-swap
listener:
e.to.search
e.to.search
.
A third approach would be to link to the same page without any hash fragment as in the kangaroo demo and have some way to find out where to scroll to like this link. Because the URL does not change, no entries will be added to the browser history. When you press back you will leave the page.