Skip to content

::ng-deep becomes :is() with CSS files #58996

Open

Description

@Zefling

Which @angular/* package(s) are the source of the bug?

compiler

Is this a regression?

Yes

Description

In CSS file (not SCSS), when using ::ng-deep the result is broken.

pre {
    white-space: pre-wrap;

    ::ng-deep {
        h3 {
            margin: 0px;
            border-bottom: 1px solid;
            padding: 0 6px 6px;
        }

        .license {
            margin-right: 5px;
            font-size: 20px;
            text-align: right;
        }
    }
}

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

**In build**


▲ [WARNING] 1 rules skipped due to selector errors:
  :is() -> Empty sub-selector


**In browser**


pre[_ngcontent-ng-c2840326293] {
    white-space:pre-wrap
}
:is()   h3[_ngcontent-ng-c2840326293] {
    margin:0;
    border-bottom:1px solid;
    padding:0 6px 6px
}
:is()   .license[_ngcontent-ng-c2840326293] {
    margin-right:5px;
    font-size:20px;
    text-align:right
}

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 19.0.2
Node: 20.11.1
Package Manager: npm 10.2.4
OS: linux x64

Angular: 19.0.1
... animations, cdk, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1900.2
@angular-devkit/build-angular   19.0.2
@angular-devkit/core            19.0.2 (cli-only)
@angular-devkit/schematics      19.0.2
@angular/cli                    19.0.2
@schematics/angular             19.0.2
rxjs                            7.8.1
typescript                      5.6.3
zone.js                         0.15.0

Anything else?

No response

Activity

  1. Zefling commented on Nov 29, 2024

    @Zefling
    Author

    With .browserslistrc

    fully supports css-nesting
    

    Result in browser with another warning in build:

    pre[_ngcontent-ng-c2840326293] {
        white-space:pre-wrap;
        ::ng-deep {
            h3 {
                margin:0;
                border-bottom:1px solid;
                padding:0 6px 6px
            }
            .license {
                margin-right:5px;
                font-size:20px;
                text-align:right
            }
        }
    }
  2. transferred this issue fromangular/angularon Dec 2, 2024
  3. JoostK commented on Dec 2, 2024

    @JoostK
    Member

    CSS nesting is not supported at all for view encapsulation emulation.

  4. transferred this issue fromangular/angular-clion Dec 2, 2024
  5. added
    area: core
    on Dec 2, 2024
  6. modified the milestone: needsTriage on Dec 2, 2024
  7. weilinzung commented on Jul 13, 2025

    @weilinzung

    @alan-agius4 By turning off nesting styles for esbuild which creating issue for TailwindCSS 4: tailwindlabs/tailwindcss#18520 (reply in thread)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: corecore: CSS encapsulationcore: stylesheets

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions