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

fix(material-experimental/mdc-button): density styles being overwritten by structural styles #22736

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/material-experimental/mdc-button/_button-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,11 @@
.mat-mdc-raised-button,
.mat-mdc-unelevated-button,
.mat-mdc-outlined-button {
@include mdc-button-theme.density($density-scale, $query: mdc-helpers.$mat-base-styles-query);
@include button-theme-private.touch-target-density($density-scale);
// Use `mat-mdc-button-base` to increase the specificity over the button's structural styles.
&.mat-mdc-button-base {
@include mdc-button-theme.density($density-scale, $query: mdc-helpers.$mat-base-styles-query);
@include button-theme-private.touch-target-density($density-scale);
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/material-experimental/mdc-button/_icon-button-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@

@mixin density($config-or-theme) {
$density-scale: theming.get-density-config($config-or-theme);
.mat-mdc-icon-button {
// Use `mat-mdc-button-base` to increase the specificity over the button's structural styles.
.mat-mdc-icon-button.mat-mdc-button-base {
@include mdc-icon-button.density($density-scale, $query: mdc-helpers.$mat-base-styles-query);
@include button-theme-private.touch-target-density($density-scale);
}
Expand Down