Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS sibling selector to target <slot> fallback #8284

Closed
janosh opened this issue Feb 14, 2023 · 1 comment · Fixed by #8422
Closed

CSS sibling selector to target <slot> fallback #8284

janosh opened this issue Feb 14, 2023 · 1 comment · Fixed by #8422
Labels
bug compiler Changes relating to the compiler

Comments

@janosh
Copy link
Contributor

janosh commented Feb 14, 2023

Describe the bug

I guess expected behavior is debatable for how a sibling CSS selector should behave for a node inside a Svelte slot. I was expecting <slot> to be invisible to the CSS selector, i.e. for it to behave as if the slot was replaced by its fallback.

Reproduction

REPL.

span color is not red in this repro, meaning the slot acts as real DOM node breaking the sibling relationship between h1 and span.

<h1>test</h1>
<slot><span>Hello</span></slot>

<style>
  h1 + span {
    color: red;
  }
</style>

Logs

No response

System Info

N/A

Severity

annoyance

@jwerre
Copy link

jwerre commented Feb 15, 2023

Try this:

h1 + :global(span) {
  color: red;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug compiler Changes relating to the compiler
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants