Skip to content

CSS next-sibling combinator doesn't work if template is inside snippet #15487

@mary-ext

Description

@mary-ext

Describe the bug

using CSS next-sibling combinator .a + .b doesn't work as Svelte considers it unused when the template is inside a snippet.

Reproduction

Playground link

{@render Thing("foo")}
{@render Thing("bar")}

{#snippet Thing(label)}
	<div class="thing">{label}</div>
{/snippet}

<style>
	.thing {
		& + & {
			color: red;
		}
	}

	.thing + .thing {
		color: red;
	}
</style>

The second <div.thing> is expected to have a red text color.

Logs

Not applicable.

System Info

Svelte 5.22.6

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions