From aed9094f9c33bbb2134ae9551f8c5d4db4b24356 Mon Sep 17 00:00:00 2001 From: Daniel Kimmich <18580672+json-derulo@users.noreply.github.com> Date: Tue, 12 Nov 2024 20:35:40 +0100 Subject: [PATCH] fix(material/snack-bar): prevent override of snack bar action button color (#27511) Co-authored-by: Daniel Kimmich (cherry picked from commit d0cf8bfe8bc476145984e0f8f3ab7d18eea36f1a) --- .../snack-bar/snack-bar-container.scss | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/material/snack-bar/snack-bar-container.scss b/src/material/snack-bar/snack-bar-container.scss index d06b0af9cf04..a52bb8445a5e 100644 --- a/src/material/snack-bar/snack-bar-container.scss +++ b/src/material/snack-bar/snack-bar-container.scss @@ -105,14 +105,16 @@ $_side-padding: 8px; // The `mat-mdc-button` and `:not(:disabled)` here are redundant, but we need them to increase // the specificity over the button styles that may bleed in from the rest of the app. .mat-mdc-snack-bar-container .mat-mdc-button.mat-mdc-snack-bar-action:not(:disabled) { - // MDC's `action-label-text-color` should be able to do this, but the button theme has a - // higher specificity so it ends up overriding it. Define our own variable that we can - // use to control the color instead. - @include token-utils.use-tokens( - tokens-mat-snack-bar.$prefix, - tokens-mat-snack-bar.get-token-slots() - ) { - @include token-utils.create-token-slot(color, button-color); + &.mat-unthemed { + // MDC's `action-label-text-color` should be able to do this, but the button theme has a + // higher specificity so it ends up overriding it. Define our own variable that we can + // use to control the color instead. + @include token-utils.use-tokens( + tokens-mat-snack-bar.$prefix, + tokens-mat-snack-bar.get-token-slots() + ) { + @include token-utils.create-token-slot(color, button-color); + } } // Darken the ripples in the button so they're visible against the dark background.