You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
&__element (BEM-style nesting) compiles to invalid selector :is(.block)__element in v4.3.3 #20441
Since the native CSS nesting handling was introduced in v4.3.0 (#20124), the following input:
.block {
&__element {
color: red;
}
}
compiles to:
:is(.block)__element {
color: red;
}
which is invalid CSS — :is() cannot be directly concatenated with an identifier like that.
Expected behavior
Since & is immediately followed by an identifier (no combinator or pseudo-class), it should be treated as a compound selector and produce:
.block__element {
color: red;
}
This is how it worked before v4.3.0 when nesting was resolved by Lightning CSS, and how &:hover-style nesting (with a pseudo-class after &) still correctly resolves to :is(.block):hover.
@wongjn the same code was working with version 4.3.0, when I upgraded to the latest version (4.3.3), compiled CSS was broken (I haven't tried 4.3.1, 4.3.2).
Activity
wongjn commentedon Aug 29, 2026
Could you provide a git repo where it was working? In Lightning CSS playground (i.e. before 4.3), it compiles to:
And in Vite with
4.2.4I get:Regardless, the nesting was always meant to follow native CSS behavior and not Sass-like behavior.
ondrej-kaspar commentedon Aug 29, 2026
@wongjn the same code was working with version 4.3.0, when I upgraded to the latest version (4.3.3), compiled CSS was broken (I haven't tried 4.3.1, 4.3.2).
I'm using
postcss-nestedplugin.