diff --git a/.changeset/shaggy-socks-glow.md b/.changeset/shaggy-socks-glow.md new file mode 100644 index 000000000000..409d02908560 --- /dev/null +++ b/.changeset/shaggy-socks-glow.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes a view transition issue on webKit browsers that prevented scrolling to #fragments diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 47c9aa6b2a9f..93c348b26fa0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,8 +2,7 @@ We welcome contributions of any size and skill level. As an open source project, we believe in giving back to our contributors and are happy to help with guidance on PRs, technical writing, and turning any feature idea into a reality. -> **Tip for new contributors:** -> Take a look at [https://github.com/firstcontributions/first-contributions](https://github.com/firstcontributions/first-contributions) for helpful information on contributing +> [!Tip] > **For new contributors:** Take a look at [https://github.com/firstcontributions/first-contributions](https://github.com/firstcontributions/first-contributions) for helpful information on contributing ## Quick Guide @@ -46,7 +45,8 @@ To get started, create a codespace for this repository by clicking this 👇 Your new codespace will open in a web-based version of Visual Studio Code. All development dependencies will be preinstalled, and the tests will run automatically ensuring you've got a green base from which to start working. -**Note**: Dev containers is now an open spec which is supported by [GitHub Codespaces](https://github.com/codespaces) and [other supporting tools](https://containers.dev/supporting). +> [!Note] +> Dev containers is now an open spec which is supported by [GitHub Codespaces](https://github.com/codespaces) and [other supporting tools](https://containers.dev/supporting). ### Development @@ -187,7 +187,7 @@ Understanding in which environment code runs, and at which stage in the process, Active Astro development happens on the [`main`](https://github.com/withastro/astro/tree/main) branch. `main` always reflects the latest code. -> **Note:** +> [!Note] > During certain periods, we put `main` into a [**prerelease**](https://github.com/changesets/changesets/blob/main/docs/prereleases.md#prereleases) state. Read more about [Releasing Astro](#releasing-astro). ### `latest` @@ -198,7 +198,8 @@ By default, `create-astro` and [astro.new](https://astro.new) point to this bran ## Releasing Astro -_Note: Only [core maintainers (L3+)](https://github.com/withastro/.github/blob/main/GOVERNANCE.md#level-3-l3---core) can release new versions of Astro._ +> [!Note] +> Only [core maintainers (L3+)](https://github.com/withastro/.github/blob/main/GOVERNANCE.md#level-3-l3---core) can release new versions of Astro. The repo is set up with automatic releases, using the changeset GitHub action & bot. diff --git a/packages/astro/src/transitions/router.ts b/packages/astro/src/transitions/router.ts index a97abfcf77a2..6ff0efc01d3b 100644 --- a/packages/astro/src/transitions/router.ts +++ b/packages/astro/src/transitions/router.ts @@ -194,7 +194,6 @@ const moveToLocation = (to: URL, from: URL, options: Options, historyState?: Sta to.href ); } - history.scrollRestoration = 'manual'; } // now we are on the new page for non-history navigations! // (with history navigation page change happens before popstate is fired) @@ -213,12 +212,14 @@ const moveToLocation = (to: URL, from: URL, options: Options, historyState?: Sta // because we are already on the target page ... // ... what comes next is a intra-page navigation // that won't reload the page but instead scroll to the fragment + history.scrollRestoration = 'auto'; location.href = to.href; } else { if (!scrolledToTop) { scrollTo({ left: 0, top: 0, behavior: 'instant' }); } } + history.scrollRestoration = 'manual'; } };