Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS styles not applied if using multiple attribute selectors to style an element with the direct child selector #49157

Open
Marcarrian opened this issue Feb 22, 2023 · 2 comments · May be fixed by #49169
Labels
area: core Issues related to the framework runtime P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent state: has PR
Milestone

Comments

@Marcarrian
Copy link

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

compiler

Is this a regression?

Yes

Description

If using multiple attribute selectors to style an element with the direct child selector, the styles are not applied.
This happens only in a development build.

Reproduction:
app.component.html

<div class="example-1">
  Example 1
</div>
<div class="example-2">
  Example 2
</div>

app.component.scss

:host {
  &:is([data-foo="bar"]) {
    > div.example-1 {
      background-color: lightskyblue; // working in dev and prod build
    }
  }

  &:is([data-foo="bar"], [data-foo-2="bar-2"]) {
    > div.example-2 {
      background-color: violet; // ONLY working in prod build
    }
  }
}

Please provide a link to a minimal reproduction of the bug

https://github.com/Marcarrian/angular-15-css-multiple-attribute-selectors-issue

Please provide the exception or error you saw

No response

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

Angular CLI: 15.1.6
Node: 16.16.0
Package Manager: npm 8.11.0
OS: win32 x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1501.6
@angular-devkit/build-angular   15.1.6
@angular-devkit/core            15.1.6
@angular-devkit/schematics      15.1.6
@angular/cli                    15.1.6
@schematics/angular             15.1.6
rxjs                            7.8.0
typescript                      4.9.5

Anything else?

No response

@JeanMeche
Copy link
Member

Basically, the support for multiple arguments for CSS pseudo class functions was broken.

I've opened the PR that fixes this.

@AndrewKushnir AndrewKushnir added area: core Issues related to the framework runtime P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels Feb 24, 2023
@ngbot ngbot bot added this to the Backlog milestone Feb 24, 2023
@lipadeus
Copy link

lipadeus commented Feb 3, 2024

Is this resolved? Having several strange things going on with scss compiler doing animations on child selectors. Never had this problem before in ruby on rails "compass" scss compiler.

For example

@for $i from 1 through 4 {
  li:nth-last-child(#{$i}){
    a{
      transform: translateX(-100vw);
      transition: background-color;
      transition-duration: 0.2s;
      transition-timing-function: ease-in-out;
      animation: menuDesktopPopulate 0.3s ease-out #{$i * 0.1}s forwards;
      &:hover {
        animation: fadeAndBlink 0.3s ease-out #{$i * 0.1}s forwards;
      }
    }
  }
}

This renders out so the menuDesktopPopulate is added to the &:hover instead of fadeAndBlink

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: core Issues related to the framework runtime P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent state: has PR
Projects
None yet
4 participants