Describe the bug
I found this odd behaviour when using an anchor element that included a child that should not trigger navigation. Tried doing event.preventDefault on the child as it prevents the navigation but still calls the preload function.
I don't think it is the intended behaviour as the fetched data is not used for the (cancelled) navigation and might be stale if a later navigation happens.
It is a one line fix. Just checking event.defaultPrevented here would prevent the preloading.
Reproduction
Was not able to run the https://node.new/sveltekit with the latest svelte v5 and sveltekit versions but I think the bug is obvious as the mousedown and touchstart listeners are attached just a few lines below the tap() function and there is no event.defaultPrevented check on any of them, unlike the click event, which is checking it here.
Logs
No response
System Info
System:
OS: Windows 11 10.0.22631
CPU: (12) x64 AMD Ryzen 5 3600XT 6-Core Processor
Memory: 19.54 GB / 63.93 GB
Binaries:
Node: 22.5.1 - C:\Program Files\nodejs\node.EXE
npm: 10.8.2 - C:\Program Files\nodejs\npm.CMD
pnpm: 9.6.0 - C:\Program Files\nodejs\pnpm.CMD
bun: 1.1.21 - ~\.bun\bin\bun.EXE
Browsers:
Edge: Chromium (127.0.2651.74)
Internet Explorer: 11.0.22621.3527
npmPackages:
@sveltejs/adapter-static: ^3.0.2 => 3.0.2
@sveltejs/kit: ^2.5.18 => 2.5.18
@sveltejs/vite-plugin-svelte: ^3.1.1 => 3.1.1
svelte: 5.0.0-next.200 => 5.0.0-next.200
vite: ^5.3.5 => 5.3.5
Severity
annoyance
Additional Information
No response