-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Description
Describe the bug
With router: { type: 'hash' } enabled, navigating between routes triggers a browser console warning: Empty string passed to getElementById(). My guess: the hash-based router is conflicting with the built-in scroll/anchor handling and trying to apply both hash navigation and scroll-to-anchor, leading to a getElementById('') call.
Reproduction
- Create a new SvelteKit project (e.g., npx sv create) and enable router: { type: 'hash' } in svelte.config.js (with adapter-static fallback).
- Add two routes: src/routes/+page.svelte and src/routes/about/+page.svelte, each linking to the other with <a href={resolve('/')}> and <a href={resolve('/about')}>.
- Run npm run dev, open the app, and click between Home and About.
- Observe the browser console showing Empty string passed to getElementById() on navigation.
Logs
System Info
System:
OS: macOS 15.6
CPU: (8) arm64 Apple M2
Memory: 127.45 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.13.1 - /opt/homebrew/bin/node
Yarn: 1.22.22 - /opt/homebrew/bin/yarn
npm: 11.6.3 - /opt/homebrew/bin/npm
pnpm: 10.23.0 - /opt/homebrew/bin/pnpm
Browsers:
Firefox: 145.0
Safari: 18.6
npmPackages:
@sveltejs/adapter-static: ~3.0 => 3.0.10
@sveltejs/kit: ~2.48 => 2.48.6
@sveltejs/vite-plugin-svelte: ~6.2 => 6.2.1
svelte: ~5.43 => 5.43.13
vite: ~7.2 => 7.2.4Severity
annoyance
Additional Information
No response
Metadata
Metadata
Assignees
Labels
No labels