Skip to content

bug(material/slide-toggle): Sass deprecation warning since v18.2.0 #29591

Closed

Description

@json-derulo

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

18.1.x

Description

After updating to Angular 18.2.0 in an app using Angular Material with a custom theme, the following Sass warning is produced:

▲ [WARNING] Deprecation [plugin angular-sass]

    node_modules/@angular/material/slide-toggle/_slide-toggle-theme.scss:46:6:
      46 │       --mdc-switch-disabled-label-text-color: #{inspection.get-the...
         ╵       ^

          $theme,
          foreground,
          disabled-text
        )};

  Sass's behavior for declarations that appear after nested
  rules will be changing to match the behavior specified by CSS in an upcoming
  version. To keep the existing behavior, move the declaration above the nested
  rule. To opt into the new behavior, wrap the declaration in `& {}`.
  
  More info: https://sass-lang.com/d/mixed-decls

The warning originates from the Slide Toggle theme:

--mdc-switch-disabled-label-text-color: #{inspection.get-theme-color(

Reproduction

StackBlitz link: https://stackblitz.com/edit/tq6jmr?file=src%2Fstyles.scss
Steps to reproduce:

  1. Build / start the project

Expected Behavior

No Sass warning produced

Actual Behavior

Sass warning is produced

Environment

Angular CLI: 18.2.0
Node: 18.20.3
Package Manager: yarn 1.22.19
OS: linux x64

Angular: 18.2.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, localize, material, material-experimental
... material-moment-adapter, platform-browser
... platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.1802.0
@angular-devkit/build-angular 18.2.0
@angular-devkit/core 18.2.0
@angular-devkit/schematics 18.2.0
@schematics/angular 18.2.0
rxjs 7.4.0
typescript 5.4.5
zone.js 0.14.6

Activity

  1. added
    needs triage
    on Aug 15, 2024
  2. changed the title [-]bug(material/slide-toggle): Sass deprecation warning[/-] [+]bug(material/slide-toggle): Sass deprecation warning since v18.2.0[/+] on Aug 15, 2024
  3. martinboue commented on Aug 15, 2024

    @martinboue
    Contributor

    Same observation with M3 custom theme.

  4. crisbeto commented on Aug 15, 2024

    @crisbeto
    Member

    What version of Sass are you running?

  5. self-assigned this
    on Aug 15, 2024
  6. added
    P3
    and removed
    needs triage
    on Aug 15, 2024
  7. json-derulo commented on Aug 15, 2024

    @json-derulo
    ContributorAuthor

    I'm not overriding the Sass version, I'm using the one from @angular-devkit/build-angular. Their sass version is v1.77.8. According to the sass changelog, this warning was added with v1.77.7.

  8. added
    P2
    and removed
    P3
    on Aug 16, 2024
  9. added 2 commits that reference this issue on Aug 16, 2024
    5d74558
    f3e7a14
  10. xylplm commented on Aug 17, 2024

    @xylplm

    I also encountered the same problem after upgrading to Angular 18.2.0

    `▲ [WARNING] Deprecation [plugin angular-sass]

    node_modules/@angular/material/slide-toggle/_slide-toggle-theme.scss:46:6:
      46 │       --mdc-switch-disabled-label-text-color: #{inspection.get-the...
         ╵       ^
    
          $theme,
          foreground,
          disabled-text
        )};
    

    Sass's behavior for declarations that appear after nested
    rules will be changing to match the behavior specified by CSS in an upcoming
    version. To keep the existing behavior, move the declaration above the nested
    rule. To opt into the new behavior, wrap the declaration in & {}.

    More info: https://sass-lang.com/d/mixed-decls

    The plugin "angular-sass" was triggered by this import

    angular:styles/global:styles:2:8:
      2 │ @import 'src/assets/scss/style.scss';
        ╵         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
    
  11. zwjohn commented on Aug 17, 2024

    @zwjohn

    The same here

    Sass's behavior for declarations that appear after nested
    rules will be changing to match the behavior specified by CSS in an upcoming
    version. To keep the existing behavior, move the declaration above the nested
    rule. To opt into the new behavior, wrap the declaration in & {}.

    More info: https://sass-lang.com/d/mixed-decls

    The plugin "angular-sass" was triggered by this import

    angular:styles/global:styles:1:8:
      1 │ @import 'src/styles.scss';
        ╵         ~~~~~~~~~~~~~~~~~
    
  12. PhilFlash commented on Aug 18, 2024

    @PhilFlash

    Same problem here after upgrading to Angular 18.2.0

    ``
    ▲ [WARNING] Deprecation [plugin angular-sass]

    node_modules/@angular/material/slide-toggle/_slide-toggle-theme.scss:46:6:
      46 │       --mdc-switch-disabled-label-text-color: #{inspection.get-the...
         ╵       ^
    
          $theme,
          foreground,
          disabled-text
        )};
    

    Sass's behavior for declarations that appear after nested
    rules will be changing to match the behavior specified by CSS in an upcoming
    version. To keep the existing behavior, move the declaration above the nested
    rule. To opt into the new behavior, wrap the declaration in & {}.

    More info: https://sass-lang.com/d/mixed-decls

    The plugin "angular-sass" was triggered by this import

    angular:styles/global:theme-purple:1:8:
      1 │ @import 'src/styles/_theme_purple.scss';
        ╵         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    

    ``

  13. added 2 commits that reference this issue on Aug 20, 2024
    367486b
    4d7e32a
  14. crisbeto commented on Aug 20, 2024

    @crisbeto
    Member

    Following up here: fixing these deprecation warnings will change the order in which some CSS will be generated which can break some users so we want to delay them until v19. To address the issue we'll:

    1. Downgrade the CLI to a version before the warning started being logged (see build: downgrade sass version angular-cli#28234). If you're managing the Sass dependency yourself, you should set the version to be lower than 1.77.7.
    2. Land fix(multiple): account for mixed declarations in latest Sass version #29596 in v19.
    3. Talk to the Sass team to see if there's a better way to handle it on our end, like potentially a new syntax.
  15. added a commit that references this issue on Aug 20, 2024
    0752d8b
  16. added a commit that references this issue on Aug 20, 2024
  17. added a commit that references this issue on Aug 20, 2024
    e6a0f28
  18. added a commit that references this issue on Aug 20, 2024
    01711b1
  19. angular-automatic-lock-bot commented on Sep 20, 2024

    @angular-automatic-lock-bot

    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.

  20. locked and limited conversation to collaborators on Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2area: material/slide-toggle

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions