Repository: sveltejs/kit (js)

Issue:
Add option to prefetch links by default
<!--
If you'd like to propose an implementation for a large new feature or change then please create an RFC:
https://github.com/sveltejs/rfcs
-->

## Is your feature request related to a problem? Please describe.

There should be an option to prefetch links by default. In my opinion, page transitions should always be instantaneous if possible. And this is the default in other frameworks like Next.js and Gatsby.

Now you could just add `sveltekit:prefetch` to every single `<a>` tag, but there are some reasons why this isn't practical/possible.

- It's annoying
- You can easily forget some
- If you're parsing markdown, you may not be able to add the prefetch attribute
- When dealing with user-generated content (purely on the browser), again, it may not be possible to add the attribute
- If you're using 3rd-party components, you cannot add the attribute

And not only are faster transitions better user experience, in some industries (like eCommerce), the extra 150-500 milliseconds can mean millions of dollars of more revenue.

## Describe the solution you'd like
Add field to `svelte.config.cjs` to automatically prefetch pages. Perhaps something like this?

```
module.exports = {
  kit: {
    prefetchLinks: true,
  },
};
```

Now there are likely valid reasons to not prefetch certain links, in which case you also need a way to opt-out of prefetching. This example seems like intuitive syntax:

```svelte
<a sveltekit:prefetch={false} href="blog/what-is-sveltekit">What is SvelteKit?</a>
```

## Describe alternatives you've considered
As far as I know, the current best solution is to add `sveltekit:prefetch` to every single `<a>` tag.

Alternatively, you could call `prefetchRoutes(routes)` on every page, but this is wasteful (all routes will be prefetched) and may not work with dynamic content.

## How important is this feature to you?
I'll keep using Svelte/kit if this doesn't get added, but I'd be ecstatic if it gets added! 


Pull request description:
Apply `data-sveltekit-*` attributes to children
Closes #790. With this PR, we can set `data-sveltekit-prefetch` to the entire app if we want (and opt out on a per-element or per-subtree basis).

### Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
- [x] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
- [x] This message body should clearly illustrate what problems it solves.
- [x] Ideally, include a test that fails without this PR but passes with it.

### Tests
- [x] Run the tests with `pnpm test` and lint the project with `pnpm lint` and `pnpm check`

### Changesets
- [x] If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running `pnpm changeset` and following the prompts. All changesets should be `patch` until SvelteKit 1.0


Patch:
diff --git a/.changeset/breezy-timers-tan.md b/.changeset/breezy-timers-tan.md
new file mode 100644
index 000000000..c9e6a71cb
--- /dev/null
+++ b/.changeset/breezy-timers-tan.md
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+Apply `data-sveltekit-prefetch/noscroll/reload` to all child `<a>` elements
diff --git a/.changeset/fresh-lemons-fail.md b/.changeset/fresh-lemons-fail.md
new file mode 100644
index 000000000..fb72fbb82
--- /dev/null
+++ b/.changeset/fresh-lemons-fail.md
@@ -0,0 +1,5 @@
+---
+'create-svelte': patch
+---
+
+Move `data-sveltekit-prefetch` to `<nav>` element
diff --git a/.changeset/nine-spoons-carry.md b/.changeset/nine-spoons-carry.md
new file mode 100644
index 000000000..1af837ccc
--- /dev/null
+++ b/.changeset/nine-spoons-carry.md
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+[fix] Saving the root route will write types now
diff --git a/documentation/docs/00-introduction.md b/documentation/docs/00-introduction.md
index 9416b4545..afe9aec69 100644
--- a/documentation/docs/00-introduction.md
+++ b/documentation/docs/00-introduction.md
@@ -12,7 +12,7 @@ title: Introduction
 
 SvelteKit is a framework for building extremely high-performance web apps.
 
-Building an app with all the modern best practices is fiendishly complicated. Those practices include [build optimizations](https://vitejs.dev/guide/features.html#build-optimizations), so that you load only the minimal required code; [offline support](/docs/service-workers); [prefetching](/docs/a-options#sveltekit-prefetch) pages before the user initiates navigation; and [configurable rendering](/docs/page-options) that allows you to render your app [on the server](/docs/appendix#ssr) or [in the browser](/docs/appendix#csr) at runtime or [at build-time](/docs/page-options#prerender). SvelteKit does all the boring stuff for you so that you can get on with the creative part.
+Building an app with all the modern best practices is fiendishly complicated. Those practices include [build optimizations](https://vitejs.dev/guide/features.html#build-optimizations), so that you load only the minimal required code; [offline support](/docs/service-workers); [prefetching](/docs/link-options#data-sveltekit-prefetch) pages before the user initiates navigation; and [configurable rendering](/docs/page-options) that allows you to render your app [on the server](/docs/appendix#ssr) or [in the browser](/docs/appendix#csr) at runtime or [at build-time](/docs/page-options#prerender). SvelteKit does all the boring stuff for you so that you can get on with the creative part.
 
 It uses [Vite](https://vitejs.dev/) with a [Svelte plugin](https://github.com/sveltejs/vite-plugin-svelte) to provide a lightning-fast and feature-rich development experience with [Hot Module Replacement (HMR)](https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#hot), where changes to your code are reflected in the browser instantly.
 
diff --git a/documentation/docs/09-a-options.md b/documentation/docs/09-a-options.md
deleted file mode 100644
index 090b603a6..000000000
--- a/documentation/docs/09-a-options.md
+++ /dev/null
@@ -1,45 +0,0 @@
----
-title: Anchor options
----
-
-### data-sveltekit-prefetch
-
-SvelteKit uses code splitting to break your app into small chunks (one per route), ensuring fast startup times.
-
-For _dynamic_ routes, such as our `src/routes/blog/[slug]/+page.svelte` example, that's not enough. In order to render the blog post, we need to fetch the data for it, and we can't do that until we know what `slug` is. In the worst case, that could cause lag as the browser waits for the data to come back from the server.
-
-We can mitigate that by _prefetching_ the data. Adding a `data-sveltekit-prefetch` attribute to a link...
-
-```html
-<a data-sveltekit-prefetch href="blog/what-is-sveltekit">What is SvelteKit?</a>
-```
-
-...will cause SvelteKit to run the page's `load` function as soon as the user hovers over the link (on a desktop) or touches it (on mobile), rather than waiting for the `click` event to trigger navigation. Typically, this buys us an extra couple of hundred milliseconds, which is the difference between a user interface that feels laggy, and one that feels snappy.
-
-You can also programmatically invoke `prefetch` from `$app/navigation`.
-
-### data-sveltekit-reload
-
-By default, the SvelteKit runtime intercepts clicks on `<a>` elements and bypasses the normal browser navigation for relative (same-origin) URLs that match one of your page routes. We sometimes need to tell SvelteKit that certain links need to be handled by normal browser navigation. Examples of this might be linking to another page on your domain that's not part of your SvelteKit app or linking to an endpoint.
-
-Adding a `data-sveltekit-reload` attribute to a link...
-
-```html
-<a data-sveltekit-reload href="path">Path</a>
-```
-
-...will cause browser to navigate via a full page reload when the link is clicked.
-
-Links with a `rel="external"` attribute will receive the same treatment. In addition, they will be ignored during [prerendering](https://kit.svelte.dev/docs/page-options#prerender).
-
-### data-sveltekit-noscroll
-
-When navigating to internal links, SvelteKit mirrors the browser's default navigation behaviour: it will change the scroll position to 0,0 so that the user is at the very top left of the page (unless the link includes a `#hash`, in which case it will scroll to the element with a matching ID).
-
-In certain cases, you may wish to disable this behaviour. Adding a `data-sveltekit-noscroll` attribute to a link...
-
-```html
-<a href="path" data-sveltekit-noscroll>Path</a>
-```
-
-...will prevent scrolling after the link is clicked.
diff --git a/documentation/docs/09-link-options.md b/documentation/docs/09-link-options.md
new file mode 100644
index 000000000..b77ab71f7
--- /dev/null
+++ b/documentation/docs/09-link-options.md
@@ -0,0 +1,66 @@
+---
+title: Link options
+---
+
+In SvelteKit, `<a>` elements (rather than framework-specific `<Link>` components) are used to navigate between the routes of your app. If the user clicks on a link whose `href` is 'owned' by the app (as opposed to, say, a link to an external site) then SvelteKit will navigate to the new page by importing its code and then calling any `load` functions it needs to fetch data.
+
+You can customise the behaviour of links with `data-sveltekit-*` attributes. These can be applied to the `<a>` itself, or to a parent element.
+
+### data-sveltekit-prefetch
+
+To get a head start on importing the code and fetching the page's data, use the `data-sveltekit-prefetch` attribute, which will start loading everything as soon as the user hovers over the link (on a desktop) or touches it (on mobile), rather than waiting for the `click` event to trigger navigation. Typically, this buys us an extra couple of hundred milliseconds, which is the difference between a user interface that feels laggy, and one that feels snappy.
+
+To apply this behaviour across the board, add the attribute to a parent element (or even the `<body>` in your `src/app.html`):
+
+```html
+/// file: src/routes/+layout.svelte
+<main data-sveltekit-prefetch>
+	<slot />
+</main>
+```
+
+> You can also programmatically invoke `prefetch` from `$app/navigation`.
+
+### data-sveltekit-reload
+
+Occasionally, we need to tell SvelteKit not to handle a link, but allow the browser to handle it. Adding a `data-sveltekit-reload` attribute to a link...
+
+```html
+<a data-sveltekit-reload href="/path">Path</a>
+```
+
+...will cause a full-page navigation when the link is clicked.
+
+Links with a `rel="external"` attribute will receive the same treatment. In addition, they will be ignored during [prerendering](/docs/page-options#prerender).
+
+### data-sveltekit-noscroll
+
+When navigating to internal links, SvelteKit mirrors the browser's default navigation behaviour: it will change the scroll position to 0,0 so that the user is at the very top left of the page (unless the link includes a `#hash`, in which case it will scroll to the element with a matching ID).
+
+In certain cases, you may wish to disable this behaviour. Adding a `data-sveltekit-noscroll` attribute to a link...
+
+```html
+<a href="path" data-sveltekit-noscroll>Path</a>
+```
+
+...will prevent scrolling after the link is clicked.
+
+### Disabling options
+
+To disable any of these options inside an element where they have been enabled, use the `"off"` value:
+
+```html
+<div data-sveltekit-prefetch>
+	<!-- these links will be prefetched -->
+	<a href="/a">a</a>
+	<a href="/b">b</a>
+	<a href="/c">c</a>
+
+	<div data-sveltekit-prefetch="off">
+		<!-- these links will NOT be prefetched -->
+		<a href="/d">d</a>
+		<a href="/e">e</a>
+		<a href="/f">f</a>
+	</div>
+</div>
+```
diff --git a/packages/create-svelte/templates/default/src/lib/header/Header.svelte b/packages/create-svelte/templates/default/src/lib/header/Header.svelte
index a048e0ecc..b0553b340 100644
--- a/packages/create-svelte/templates/default/src/lib/header/Header.svelte
+++ b/packages/create-svelte/templates/default/src/lib/header/Header.svelte
@@ -10,19 +10,19 @@
 		</a>
 	</div>
 
-	<nav>
+	<nav data-sveltekit-prefetch>
 		<svg viewBox="0 0 2 3" aria-hidden="true">
 			<path d="M0,0 L1,2 C1.5,3 1.5,3 2,3 L2,0 Z" />
 		</svg>
 		<ul>
 			<li class:active={$page.url.pathname === '/'}>
-				<a data-sveltekit-prefetch href="/">Home</a>
+				<a href="/">Home</a>
 			</li>
 			<li class:active={$page.url.pathname === '/about'}>
-				<a data-sveltekit-prefetch href="/about">About</a>
+				<a href="/about">About</a>
 			</li>
 			<li class:active={$page.url.pathname === '/todos'}>
-				<a data-sveltekit-prefetch href="/todos">Todos</a>
+				<a href="/todos">Todos</a>
 			</li>
 		</ul>
 		<svg viewBox="0 0 2 3" aria-hidden="true">
diff --git a/packages/kit/src/core/sync/write_types/index.js b/packages/kit/src/core/sync/write_types/index.js
index 0a6e65152..9bfb8febc 100644
--- a/packages/kit/src/core/sync/write_types/index.js
+++ b/packages/kit/src/core/sync/write_types/index.js
@@ -71,8 +71,7 @@ export async function write_types(config, manifest_data, file) {
 		return;
 	}
 
-	const filepath = path.relative(config.kit.files.routes, file);
-	const id = path.dirname(filepath);
+	const id = path.relative(config.kit.files.routes, path.dirname(file));
 
 	const route = manifest_data.routes.find((route) => route.id === id);
 	if (!route) return; // this shouldn't ever happen
diff --git a/packages/kit/src/runtime/client/client.js b/packages/kit/src/runtime/client/client.js
index 5ef45d5d3..6b95fbbfd 100644
--- a/packages/kit/src/runtime/client/client.js
+++ b/packages/kit/src/runtime/client/client.js
@@ -1,7 +1,7 @@
 import { onMount, tick } from 'svelte';
 import { normalize_error } from '../../utils/error.js';
 import { make_trackable, decode_params, normalize_path } from '../../utils/url.js';
-import { find_anchor, get_base_uri, get_href, scroll_state } from './utils.js';
+import { find_anchor, get_base_uri, scroll_state } from './utils.js';
 import { lock_fetch, unlock_fetch, initial_fetch, native_fetch } from './fetcher.js';
 import { parse } from './parse.js';
 import { error } from '../../exports/index.js';
@@ -1139,9 +1139,9 @@ export function create_client({ target, base, trailing_slash }) {
 
 			/** @param {Event} event */
 			const trigger_prefetch = (event) => {
-				const a = find_anchor(event);
-				if (a && a.href && a.hasAttribute('data-sveltekit-prefetch')) {
-					prefetch(get_href(a));
+				const { url, options } = find_anchor(event);
+				if (url && options.prefetch === '') {
+					prefetch(url);
 				}
 			};
 
@@ -1172,13 +1172,10 @@ export function create_client({ target, base, trailing_slash }) {
 				if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
 				if (event.defaultPrevented) return;
 
-				const a = find_anchor(event);
-				if (!a) return;
-
-				if (!a.href) return;
+				const { a, url, options } = find_anchor(event);
+				if (!a || !url) return;
 
 				const is_svg_a_element = a instanceof SVGAElement;
-				const url = get_href(a);
 
 				// Ignore non-HTTP URL protocols (e.g. `mailto:`, `tel:`, `myapp:`, etc.)
 				// MEMO: Without this condition, firefox will open mailer twice.
@@ -1192,11 +1189,7 @@ export function create_client({ target, base, trailing_slash }) {
 				// 2. 'rel' attribute includes external
 				const rel = (a.getAttribute('rel') || '').split(/\s+/);
 
-				if (
-					a.hasAttribute('download') ||
-					rel.includes('external') ||
-					a.hasAttribute('data-sveltekit-reload')
-				) {
+				if (a.hasAttribute('download') || rel.includes('external') || options.reload === '') {
 					return;
 				}
 
@@ -1222,7 +1215,7 @@ export function create_client({ target, base, trailing_slash }) {
 
 				navigate({
 					url,
-					scroll: a.hasAttribute('data-sveltekit-noscroll') ? scroll_state() : null,
+					scroll: options.noscroll === '' ? scroll_state() : null,
 					keepfocus: false,
 					redirect_chain: [],
 					details: {
diff --git a/packages/kit/src/runtime/client/utils.js b/packages/kit/src/runtime/client/utils.js
index 8a2dafd74..1f6a659b1 100644
--- a/packages/kit/src/runtime/client/utils.js
+++ b/packages/kit/src/runtime/client/utils.js
@@ -24,17 +24,44 @@ export function scroll_state() {
 
 /** @param {Event} event */
 export function find_anchor(event) {
-	const node = event
-		.composedPath()
-		.find((e) => e instanceof Node && e.nodeName.toUpperCase() === 'A'); // SVG <a> elements have a lowercase name
-	return /** @type {HTMLAnchorElement | SVGAElement | undefined} */ (node);
-}
+	/** @type {HTMLAnchorElement | SVGAElement | undefined} */
+	let a;
+
+	const options = {
+		/** @type {string | null} */
+		noscroll: null,
+
+		/** @type {string | null} */
+		prefetch: null,
+
+		/** @type {string | null} */
+		reload: null
+	};
+
+	for (const element of event.composedPath()) {
+		if (!(element instanceof Element)) continue;
+
+		if (!a && element.nodeName.toUpperCase() === 'A') {
+			// SVG <a> elements have a lowercase name
+			a = /** @type {HTMLAnchorElement | SVGAElement} */ (element);
+		}
+
+		if (options.noscroll === null) {
+			options.noscroll = element.getAttribute('data-sveltekit-noscroll');
+		}
+
+		if (options.prefetch === null) {
+			options.prefetch = element.getAttribute('data-sveltekit-prefetch');
+		}
+
+		if (options.reload === null) {
+			options.reload = element.getAttribute('data-sveltekit-reload');
+		}
+	}
+
+	const url = a && new URL(a instanceof SVGAElement ? a.href.baseVal : a.href, document.baseURI);
 
-/** @param {HTMLAnchorElement | SVGAElement} node */
-export function get_href(node) {
-	return node instanceof SVGAElement
-		? new URL(node.href.baseVal, document.baseURI)
-		: new URL(node.href);
+	return { a, url, options };
 }
 
 /** @param {any} value */


Test patch:
diff --git a/packages/kit/test/apps/basics/src/routes/data-sveltekit/noscroll/+page.svelte b/packages/kit/test/apps/basics/src/routes/data-sveltekit/noscroll/+page.svelte
new file mode 100644
index 000000000..e9ad0b2d6
--- /dev/null
+++ b/packages/kit/test/apps/basics/src/routes/data-sveltekit/noscroll/+page.svelte
@@ -0,0 +1,8 @@
+<div style="height: 2000px; background: palegoldenrod" />
+
+<a id="one" href="/data-sveltekit/noscroll/target" data-sveltekit-noscroll>one</a>
+
+<div data-sveltekit-noscroll>
+	<a id="two" href="/data-sveltekit/noscroll/target">two</a>
+	<a id="three" href="/data-sveltekit/noscroll/target" data-sveltekit-noscroll="off">three</a>
+</div>
diff --git a/packages/kit/test/apps/basics/src/routes/data-sveltekit/noscroll/target/+page.svelte b/packages/kit/test/apps/basics/src/routes/data-sveltekit/noscroll/target/+page.svelte
new file mode 100644
index 000000000..a0c3426c8
--- /dev/null
+++ b/packages/kit/test/apps/basics/src/routes/data-sveltekit/noscroll/target/+page.svelte
@@ -0,0 +1,3 @@
+<div style="height: 2000px; background: palegoldenrod" />
+
+<h1>target</h1>
diff --git a/packages/kit/test/apps/basics/src/routes/data-sveltekit/prefetch/+page.svelte b/packages/kit/test/apps/basics/src/routes/data-sveltekit/prefetch/+page.svelte
new file mode 100644
index 000000000..04ebcd22c
--- /dev/null
+++ b/packages/kit/test/apps/basics/src/routes/data-sveltekit/prefetch/+page.svelte
@@ -0,0 +1,6 @@
+<a id="one" href="/data-sveltekit/prefetch/target" data-sveltekit-prefetch>one</a>
+
+<div data-sveltekit-prefetch>
+	<a id="two" href="/data-sveltekit/prefetch/target">two</a>
+	<a id="three" href="/data-sveltekit/prefetch/target" data-sveltekit-prefetch="off">three</a>
+</div>
diff --git a/packages/kit/test/apps/basics/src/routes/data-sveltekit/prefetch/target/+page.svelte b/packages/kit/test/apps/basics/src/routes/data-sveltekit/prefetch/target/+page.svelte
new file mode 100644
index 000000000..9c40e105a
--- /dev/null
+++ b/packages/kit/test/apps/basics/src/routes/data-sveltekit/prefetch/target/+page.svelte
@@ -0,0 +1,1 @@
+<h1>target</h1>
diff --git a/packages/kit/test/apps/basics/src/routes/data-sveltekit/reload/+page.svelte b/packages/kit/test/apps/basics/src/routes/data-sveltekit/reload/+page.svelte
new file mode 100644
index 000000000..1de9e3cd2
--- /dev/null
+++ b/packages/kit/test/apps/basics/src/routes/data-sveltekit/reload/+page.svelte
@@ -0,0 +1,6 @@
+<a id="one" href="/data-sveltekit/reload/target" data-sveltekit-reload>one</a>
+
+<div data-sveltekit-reload>
+	<a id="two" href="/data-sveltekit/reload/target">two</a>
+	<a id="three" href="/data-sveltekit/reload/target" data-sveltekit-reload="off">three</a>
+</div>
diff --git a/packages/kit/test/apps/basics/src/routes/data-sveltekit/reload/target/+page.svelte b/packages/kit/test/apps/basics/src/routes/data-sveltekit/reload/target/+page.svelte
new file mode 100644
index 000000000..9c40e105a
--- /dev/null
+++ b/packages/kit/test/apps/basics/src/routes/data-sveltekit/reload/target/+page.svelte
@@ -0,0 +1,1 @@
+<h1>target</h1>
diff --git a/packages/kit/test/apps/basics/test/client.test.js b/packages/kit/test/apps/basics/test/client.test.js
index 6bc0c73e2..53c83b05c 100644
--- a/packages/kit/test/apps/basics/test/client.test.js
+++ b/packages/kit/test/apps/basics/test/client.test.js
@@ -697,3 +697,75 @@ test.describe.serial('Invalidation', () => {
 		expect(await page.textContent('h1')).toBe('a: 4, b: 5');
 	});
 });
+
+test.describe('data-sveltekit attributes', () => {
+	test('data-sveltekit-prefetch', async ({ baseURL, page }) => {
+		const requests = [];
+		page.on('request', (r) => requests.push(r.url()));
+
+		const module = process.env.DEV
+			? `${baseURL}/src/routes/data-sveltekit/prefetch/target/+page.svelte`
+			: `${baseURL}/_app/immutable/components/pages/data-sveltekit/prefetch/target/_page`;
+
+		await page.goto('/data-sveltekit/prefetch');
+		await page.locator('#one').dispatchEvent('mousemove');
+		await Promise.all([
+			page.waitForTimeout(100), // wait for prefetching to start
+			page.waitForLoadState('networkidle') // wait for prefetching to finish
+		]);
+		expect(requests.find((r) => r.startsWith(module))).toBeDefined();
+
+		requests.length = 0;
+		await page.goto('/data-sveltekit/prefetch');
+		await page.locator('#two').dispatchEvent('mousemove');
+		await Promise.all([
+			page.waitForTimeout(100), // wait for prefetching to start
+			page.waitForLoadState('networkidle') // wait for prefetching to finish
+		]);
+		expect(requests.find((r) => r.startsWith(module))).toBeDefined();
+
+		requests.length = 0;
+		await page.goto('/data-sveltekit/prefetch');
+		await page.locator('#three').dispatchEvent('mousemove');
+		await Promise.all([
+			page.waitForTimeout(100), // wait for prefetching to start
+			page.waitForLoadState('networkidle') // wait for prefetching to finish
+		]);
+		expect(requests.find((r) => r.startsWith(module))).toBeUndefined();
+	});
+
+	test('data-sveltekit-reload', async ({ baseURL, page, clicknav }) => {
+		const requests = [];
+		page.on('request', (r) => requests.push(r.url()));
+
+		await page.goto('/data-sveltekit/reload');
+		await page.click('#one');
+		expect(requests).toContain(`${baseURL}/data-sveltekit/reload/target`);
+
+		requests.length = 0;
+		await page.goto('/data-sveltekit/reload');
+		await page.click('#two');
+		expect(requests).toContain(`${baseURL}/data-sveltekit/reload/target`);
+
+		requests.length = 0;
+		await page.goto('/data-sveltekit/reload');
+		await clicknav('#three');
+		expect(requests).not.toContain(`${baseURL}/data-sveltekit/reload/target`);
+	});
+
+	test('data-sveltekit-noscroll', async ({ page, clicknav }) => {
+		await page.goto('/data-sveltekit/noscroll');
+		// await page.evaluate(() => window.scrollTo(0, 1000));
+		await clicknav('#one');
+		expect(await page.evaluate(() => window.scrollY)).toBeGreaterThan(1000);
+
+		await page.goto('/data-sveltekit/noscroll');
+		await clicknav('#two');
+		expect(await page.evaluate(() => window.scrollY)).toBeGreaterThan(1000);
+
+		await page.goto('/data-sveltekit/noscroll');
+		// await page.evaluate(() => window.scrollTo(0, 1000));
+		await clicknav('#three');
+		expect(await page.evaluate(() => window.scrollY)).toBe(0);
+	});
+});