-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[Radio] Fix disabled state styling regression #43592
Conversation
Netlify deploy previewhttps://deploy-preview-43592--material-ui.netlify.app/ Bundle size reportDetails of bundle changes (Toolpad) |
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.
Tricky, if we want the customization experience to be consistent with the other components, e.g. Button, it seems that adding the disabled style in
[`&.${radioClasses.checked}`]: { |
Yeah, my first attempt was to not to do this, with 064907e, but the problem was that we will need to use the In the end that may be the best out of the two possible solutions. I will update the PR today. |
I've updated the PR to not change the specificity. |
let disabled = disabledProp; | ||
|
||
if (muiFormControl) { | ||
if (typeof disabled === 'undefined') { |
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.
Why only read the value if undefined
?
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.
Because the prop should take precedence over what comes form the form field context.
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.
Right, my bad 😅 I got confused and thought we were checking typeof muiFormControl.disabled === 'undefined'
(Just for the record): @mnajdova, do you know how this broke? |
@DiegoAndai can you clarify what you mean? The before primary style on the radio item is not expected, this is what the PR fixes. Unless there is something else. See v5: https://codesandbox.io/p/sandbox/staging-violet-dh3r6m?file=%2Fpackage.json%3A21%2C33&workspaceId=836800c1-9711-491c-a89b-3ac24cbd8cd8 |
@mnajdova I mean: How was this bug introduced? Did we miss something when migrating to the variants API? I'm trying to understand what was the change that introduced the regression to see if there might be similar issues elsewhere. |
Typically previously we were adding the disabled style last, however, now that we have variants, the variants are being processed after the "default styles" always. In practise this means, that previously we had:
And now with the changes:
Does this helps explain the issue? |
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.
Does this helps explain the issue?
It does! thanks 😊
Fixes #43588