Skip to content

Commit bb66db7

Browse files
json-derulommalerba
authored andcommitted
fix(material/snack-bar): prevent override of snack bar action button color (#27511)
Co-authored-by: Daniel Kimmich <[email protected]> (cherry picked from commit d0cf8bf)
1 parent 34b8910 commit bb66db7

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/material/snack-bar/snack-bar-container.scss

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,16 @@ $_side-padding: 8px;
105105
// The `mat-mdc-button` and `:not(:disabled)` here are redundant, but we need them to increase
106106
// the specificity over the button styles that may bleed in from the rest of the app.
107107
.mat-mdc-snack-bar-container .mat-mdc-button.mat-mdc-snack-bar-action:not(:disabled) {
108-
// MDC's `action-label-text-color` should be able to do this, but the button theme has a
109-
// higher specificity so it ends up overriding it. Define our own variable that we can
110-
// use to control the color instead.
111-
@include token-utils.use-tokens(
112-
tokens-mat-snack-bar.$prefix,
113-
tokens-mat-snack-bar.get-token-slots()
114-
) {
115-
@include token-utils.create-token-slot(color, button-color);
108+
&.mat-unthemed {
109+
// MDC's `action-label-text-color` should be able to do this, but the button theme has a
110+
// higher specificity so it ends up overriding it. Define our own variable that we can
111+
// use to control the color instead.
112+
@include token-utils.use-tokens(
113+
tokens-mat-snack-bar.$prefix,
114+
tokens-mat-snack-bar.get-token-slots()
115+
) {
116+
@include token-utils.create-token-slot(color, button-color);
117+
}
116118
}
117119

118120
// Darken the ripples in the button so they're visible against the dark background.

0 commit comments

Comments
 (0)