Skip to content

Slots remove whitespace where it shouldn't when <style> is used #1065

@Lectem

Description

@Lectem

Astro Info

Astro                    v5.2.5
Node                     v22.13.1
System                   Windows (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             @astrojs/mdx
                         @astrojs/sitemap

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Whitespaces are being stripped between multiple <span> elements when using Layout components (<slot>), if and only if a <style> is present.
This leads to inconsistent rendering between using slots and not using slots.

Weirdly, this is something that was discussed in withastro/astro#6893, and it was mentioned that astro not removing whitespaces was a feature !

What's the expected result?

Astro should have the same rendering results whether <slot/>/<style> are being used or not.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-wwx73rkk?file=src%2Fpages%2FindexWithLayout.astro

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

Labels

- P3: minor bugAn edge case that only affects very specific usage (priority)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions