-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(material-experimental/mdc-button): use mdc mixins to style icons within buttons #21623
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
Conversation
96793aa to
55e566c
Compare
src/material/icon/icon.ts
Outdated
|
|
||
| // Add appropriate MDC class if it is inside a MDC button to be styled properly | ||
| if (this._elementRef.nativeElement.parentElement?.classList.contains('mdc-button')) { | ||
| this._elementRef.nativeElement.classList.add('mdc-button__icon'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, we try to avoid dependencies between components, especially between MDC and non-MDC versions. I see a couple of alternatives:
- Redeclare the styles for
.mdc-button__icon, but have it target.mat-mdc-button .mat-iconinstead. I'm guessing that MDC has a mixin for it already. - Have the MDC-based button look for icons instead. This is a bit fragile, because the icon can come in at a later point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this PR had fixed it at one point: #20963 did something change that broke it again?
55e566c to
13bf892
Compare
|
The |
mmalerba
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, approving but marking as blocked until the MDC update goes in, feel free to remove the label once it goes in
|
The version was updated in acb3f33. |
|
cool, unblocking then |
|
This breaks a fair amount of screenshots but I wonder if we can easily provide an override that reverses the size. Then in the clients breaking, we just bring the size back to what they are expecting |
|
@annieyw it looks like this only fixes text buttons, the other types of button still appear to have an icon that's too big |
…raised, and outlined
13bf892 to
e822d14
Compare
|
Turns out the rest of the buttons was missing the |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Add appropriate class to mat-icon when it is within a MDC button to receive the correct styles.


(This is technically a fix for material-experimental/mdc-button but the change is in material/icon)
Before
After