Skip to content

Conversation

puckowski
Copy link
Contributor

This pull request makes sure selectors inside @scope queries are correctly scoped.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

Currently there is no support in the Angular compiler for the scope at-rule CSSWG [1] which is targeted for support in Chrome 117 Chrome Status [2] which means usage of this feature results in CSS that is not correctly scoped.

What is the new behavior?

Using the CSS scope at-rule results in properly scoped CSS.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Angular will be ready for the new browser features when they ship.

@pullapprove pullapprove bot requested a review from AndrewKushnir June 16, 2023 19:04
@angular-robot angular-robot bot added the detected: feature PR contains a feature commit label Jun 16, 2023
@pkozlowski-opensource pkozlowski-opensource added area: core Issues related to the framework runtime area: compiler Issues related to `ngc`, Angular's template compiler core: stylesheets labels Jun 20, 2023
@ngbot ngbot bot modified the milestone: Backlog Jun 20, 2023
@puckowski puckowski force-pushed the fix-css-scope-at-rule branch from 93e0e8e to d8dac6d Compare June 25, 2023 13:45
@angular-robot angular-robot bot added area: docs area: build & ci Related the build and CI infrastructure of the project labels Jun 25, 2023
@puckowski puckowski force-pushed the fix-css-scope-at-rule branch from d8dac6d to 132af0a Compare June 25, 2023 16:36
@angular-robot angular-robot bot removed area: docs area: build & ci Related the build and CI infrastructure of the project labels Jun 25, 2023
@puckowski
Copy link
Contributor Author

Did a rebase to latest main, files changed tab now looks correct.

@josephperrott josephperrott removed their request for review June 28, 2023 20:39
make sure selectors inside @scope queries are correctly scoped
@puckowski puckowski force-pushed the fix-css-scope-at-rule branch from 132af0a to d5d72fe Compare July 1, 2023 15:30
@puckowski
Copy link
Contributor Author

Did a rebase to latest main, files changed tab looks correct.

@puckowski
Copy link
Contributor Author

Will refrain from further rebases (unless stated to be required) since there is 1 approval and a few pending reviewers.

Copy link
Contributor

@MarkTechson MarkTechson left a comment

Choose a reason for hiding this comment

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

LGTM

@puckowski
Copy link
Contributor Author

Here is a StackBlitz to test scoping of the CSS scope at-rule:
https://stackblitz.com/edit/stackblitz-starters-yucdgc?file=src%2Fmain.ts

You can run the above example using Chrome with the Experimental Web Platform features flag enabled in chrome://flags/.

On Angular 16.1.4 styles applied to my-app leak into app-hello.

This pull request should fix the style leak issue for the scope at-rule.

Looks like support was pushed to Chrome 118 [1] instead of Chrome 117.

@AndrewKushnir AndrewKushnir added the action: global presubmit The PR is in need of a google3 global presubmit label Jul 11, 2023
@AndrewKushnir
Copy link
Contributor

Global Presubmit (internal-only link).

@AndrewKushnir AndrewKushnir added action: merge The PR is ready for merge by the caretaker and removed action: global presubmit The PR is in need of a google3 global presubmit labels Jul 11, 2023
@AndrewKushnir AndrewKushnir added target: minor This PR is targeted for the next minor release merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note labels Jul 11, 2023
@AndrewKushnir
Copy link
Contributor

Caretaker note: TGP is "green", this PR is ready for merge.

@dylhunn
Copy link
Contributor

dylhunn commented Jul 11, 2023

This PR was merged into the repository by commit c27a1e6.

@dylhunn dylhunn closed this in c27a1e6 Jul 11, 2023
@puckowski
Copy link
Contributor Author

Here is a StackBlitz to test scoping of the CSS scope at-rule with Angular 16.2.0-next.2:
https://stackblitz.com/edit/stackblitz-starters-vcbqhb?file=src%2Fmain.ts

You can run the above example using Chrome with the Experimental Web Platform features flag enabled in chrome://flags/.

I tested with: Version 117.0.5886.0 (Official Build) canary (64-bit)

Styles are now correctly scoped.

@scope ([data-scope='main-component']) to ([data-scope]) {
  p[_ngcontent-ng-c3427923494] {
      color: red;
  }

  section[_ngcontent-ng-c3427923494] {
      background: snow;
  }
}

@scope ([data-scope='sub-component']) to ([data-scope]) {
  p[_ngcontent-ng-c3427923494] {
      color: blue;
  }

  section[_ngcontent-ng-c3427923494] {
      color: ghostwhite;
  }
}

Thank you for merging this feature.

@AndrewKushnir
Copy link
Contributor

@puckowski thank you for contributing this feature and improving Angular 👍

sunilbaba pushed a commit to sunilbaba/angular that referenced this pull request Jul 26, 2023
make sure selectors inside @scope queries are correctly scoped

PR Close angular#50747
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Aug 13, 2023
ChellappanRajan pushed a commit to ChellappanRajan/angular that referenced this pull request Jan 23, 2024
make sure selectors inside @scope queries are correctly scoped

PR Close angular#50747
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler area: core Issues related to the framework runtime core: stylesheets detected: feature PR contains a feature commit merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants