Hovering over the link applies CSS effects
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 2.3k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 156
Description
Describe the bug
Summary
Hovering a link of a page which imports CSS file with css variables, override current page css variable.
We have this issue since version @2.48.0.
Details
+layout.svelte in each sub routes, import a different css for each different css variable. (In use case, each sub directory have different own brand color).
CSS is stored in /static folder and import like
<svelte:head>
<link href="./sub_a.css" rel="stylesheet" />
</svelte:head>
When hover a link to page, preload data is triggered.
However, css variable changed as well.
It used to not be like that before.
https://github.com/user-attachments/assets/03becd2e-0a6d-4280-a512-3ae355c31f2a
Expectation
css variable should not change on hovering the link.
Reproduction
https://www.sveltelab.dev/4302565mia8i8jy
Logs
System Info
System:
OS: macOS 14.6.1
CPU: (10) arm64 Apple M2 Pro
Memory: 70.28 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.17.0 - /Users/mymachine/.nodenv/versions/22.17.0/bin/node
Yarn: 1.22.22 - /opt/homebrew/bin/yarn
npm: 10.9.2 - /Users/mymachine/.nodenv/versions/22.17.0/bin/npm
pnpm: 10.4.1 - /Users/mymachine/.nodenv/versions/22.17.0/bin/pnpm
bun: 1.2.9 - /opt/homebrew/bin/bun
Browsers:
Chrome: 143.0.7499.41
Safari: 17.6
npmPackages:
@sveltejs/adapter-auto: 7.0.0 => 7.0.0
@sveltejs/adapter-cloudflare: 7.2.4 => 7.2.4
@sveltejs/enhanced-img: 0.9.2 => 0.9.2
@sveltejs/kit: 2.48.0 => 2.48.0
@sveltejs/vite-plugin-svelte: 6.2.1 => 6.2.1
svelte: 5.45.8 => 5.45.8
vite: 7.2.6 => 7.2.6
Severity
annoyance
Additional Information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior from the linked SvelteLab example, focusing on the per-route +layout.svelte links to CSS files in /static and the hover-triggered preload. Compare behavior with the reported change from @2.48.0, then verify that hovering a link no longer changes the current page's CSS variable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100