Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
Inline layout affected by #if block after #each | GoodFirstPicks

Inline layout affected by #if block after #each

sveltejs/svelte 3 comments 7d ago
View on GitHub
mediumopenScope: somewhat clearSkill match: maybeSvelteTypeScript

Why this is a good first issue

The issue involves unexpected spacing behavior in Svelte's template logic that may be working as intended.

AI Summary

The issue reports unexpected spacing when an #if block follows an #each block in Svelte templates. The maintainer suggests this may be working as designed, but the reporter finds it counterintuitive. The fix would require understanding Svelte's whitespace handling in template blocks.

Issue Description

Describe the bug

Having an #if block after an #each block seems to cause this weird rendering behaviour with inline elements (haven't gotten as far as testing with anything else).

The #if block, regardless of being truthy or falsy, creates some sort of unexpected spacing in the output.

I pasted an example below in the reproduction. You can see what happens if you comment out the #if block in Element.svelte.

Reproduction

https://svelte.dev/playground/28de6bf5d55840348727c1c66036551e?version=5.55.0

Logs

System Info

System:
    OS: Linux 6.14 Linux Mint 22.2 (Zara)
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 16.92 GB / 31.25 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 20.19.5 - /home/henry/.nvm/versions/node/v20.19.5/bin/node
    npm: 10.8.2 - /home/henry/.nvm/versions/node/v20.19.5/bin/npm
    pnpm: 10.22.0 - /home/henry/.nvm/versions/node/v20.19.5/bin/pnpm
  Browsers:
    Chrome: 145.0.7632.116
    Firefox: 144.0.2
    Firefox Developer Edition: 144.0.2

Severity

annoyance

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 15 points when you complete it!

Risk Flags

  • potential design limitation
  • maintainer feedback suggests expected behavior
Loading labels...

Details

Points15 pts
Difficultymedium
Scopesomewhat clear
Skill Matchmaybe
Test Focusedno