Skip to content

fix(compiler): scope nested CSS rules - #69885

Merged
amishne merged 3 commits into
angular:mainfrom
crisbeto:nested-css-again
Aug 7, 2026
Merged

amishne merged 3 commits into
angular:mainfrom
crisbeto:nested-css-again

Conversation

@crisbeto

Copy link
Copy Markdown
Member

This is a second attempt at scoping nested CSS rules after not being able to land #50693. I took some extra precautions to try and avoid the crash that was happening last time.

@crisbeto crisbeto added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Jul 22, 2026
@angular-robot angular-robot Bot added the area: compiler Issues related to `ngc`, Angular's template compiler label Jul 22, 2026
@ngbot ngbot Bot added this to the Backlog milestone Jul 22, 2026
crisbeto added a commit to crisbeto/angular that referenced this pull request Jul 27, 2026
Adds some temporary logic to strip `::ng-deep` from nested selectors which will help us land angular#69885.
@crisbeto
crisbeto force-pushed the nested-css-again branch 2 times, most recently from 369bd13 to 747233b Compare August 3, 2026 14:57
@crisbeto

crisbeto commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

Passing TGP after we land some client fixes.

@crisbeto
crisbeto requested a review from mattrbeck August 3, 2026 15:01
@crisbeto crisbeto added target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release labels Aug 3, 2026
@crisbeto
crisbeto marked this pull request as ready for review August 3, 2026 15:01
Comment thread packages/compiler/test/shadow_css/nesting_spec.ts
Comment thread packages/compiler/test/shadow_css/nesting_spec.ts Outdated
Comment thread packages/compiler/src/shadow_css.ts Outdated
Comment thread packages/compiler/test/shadow_css/nesting_spec.ts
Comment thread packages/compiler/test/shadow_css/nesting_spec.ts
Comment thread packages/compiler/src/shadow_css.ts Outdated
@crisbeto

crisbeto commented Aug 4, 2026

Copy link
Copy Markdown
Member Author

Fresh passing TGP that includes the latest code changes and the client fixes.

Comment thread packages/compiler/test/shadow_css/nesting_spec.ts Outdated
Comment thread packages/compiler/src/shadow_css.ts Outdated
Comment thread packages/compiler/src/shadow_css.ts Outdated
This is a second attempt at scoping nested CSS rules after not being able to land angular#50693. I took some extra precautions to try and avoid the crash that was happening last time.
… ::ng-deep

Updates the nested selector encapsulation logic so that it skips encapsulating child selectors if the parent contains `::ng-deep`. The reasoning is that `:host ::ng-deep { .foo {} }` should behave as `:host ::ng-deep .foo {}`.
Adds a test to cover the case where an `@import` might have a URL with special characters that isn't quoted.

@crisbeto crisbeto left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback should be addressed now.

@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Aug 5, 2026
@amishne
amishne merged commit 11b4089 into angular:main Aug 7, 2026
25 checks passed
@amishne

amishne commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

This PR was merged into the repository. The changes were merged into the following branches:

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

Labels

action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants