Open
Description
Describe the bug
This seems to be a regression of #583.
If a component is nested within another component of the same type, the parent component's scoped styles apply to the child component.
<Foo>
<!-- This shouldn't receive parent's styles, but it does... -->
<Foo />
<!-- While this doesn't. -->
<Bar />
</Foo>
Notably:
- This isn't how styling works with other components (they don't receive the parent's scoped styles).
- This seems to disagree with the documented way that scoping works.
- This produces behavior that the Svelte compiler tries to prevent with unused selectors (see example below).
- This creates a sort of redundant behavior that circumvents the intention of the
:global
selector, and decisions made in Don't cascade styles to nested components? #583.
Reproduction
You can see this in action here:
https://svelte.dev/playground/4e28edac5a874ee2a82dfd9a874d90d1?version=5.28.6
Logs
System Info
System:
OS: Linux 4.4 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Memory: 8.62 GB / 31.74 GB
Container: Yes
Shell: 5.1.16 - /usr/bin/bash
Binaries:
Node: 22.14.0 - ~/.nvm/versions/node/v22.14.0/bin/node
Yarn: 1.22.22 - ~/.nvm/versions/node/v22.14.0/bin/yarn
npm: 11.2.0 - ~/.nvm/versions/node/v22.14.0/bin/npm
pnpm: 9.15.4 - ~/.nvm/versions/node/v22.14.0/bin/pnpm
npmPackages:
svelte: ^5.25.11 => 5.28.2
Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels