-
-
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
[Select][FormControl] Make outlined variant the default one #24895
Conversation
True. I think that most developers use the composed version ( |
dddd7c0
to
1a70f5f
Compare
|
Or modify it to support both use-cases |
42b54d9
to
349a9ed
Compare
@mbrookes @oliviertassinari I need your advice on how to scope this changeset. This change seems to be triggering multiple related ones. Here's what I am seeing so far: The With that in mind, I see two possibilities: A) Change the default variant of the B) Change the default variant of <FormControl ...>
... <Input />
</FormControl> From what I see, for the above to look correct, Maybe there's C) another approach? FWIW, I am very supportive of outphasing the |
B) Sounds like the best way to go. It does involve diving into multiple parts of the codebase. |
@petyosi How is the effort going? Did you face a blocker? |
Hey, sorry for the delay, Working through the screenshot differences, I will push an update for review this week. |
81b40df
to
713d4cf
Compare
@mbrookes @oliviertassinari Please take a look, thanks! |
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.
The changes look great. One thing I am not sure about is, whether the standard
variant should still be named standard
as it is not a default value. I feel like maybe we should rename to something like underlined
variant (or anything else that is not standard
, as it not being default value means it is not standard :))
export default function TextFieldComponent(props) { | ||
return ( | ||
<div> | ||
<TextField {...props} variant="standard" /> |
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.
<TextField {...props} variant="standard" /> | |
<TextField variant="standard" {...props} /> |
Shouldn't this be the result? Otherwise, we are always overriding any variant
being part of props
. The same would be applied to the other components if this is correct.
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.
Your comment seems correct to me - the codemod was originally introduced by @mbrookes and I basically multiplied it.
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.
Ah I see, ok let's consider fixing it in a separate PR.
@mnajdova If I recall correctly, the name originates from when we introduced the filled, and outlined variant. It likely has this meaning:
https://dictionary.cambridge.org/dictionary/english/standard It doesn't age well if it's not the default, agree. Should it be enough to make a breaking change? I guess we have to weigh the cost. cc @mbrookes. In any case, I think that it's outside the scope of this PR and should concern a potential follow-up. Personally, I think that it would cost a lot for some value, maybe not enough. |
Agree, it is definitely out of the scope of this PR, just thought to mention it as we are making the changes now. So far developers were never typing Let me update the branch with the latest changes, so we can take a look on the changes & visual regressions better. |
@@ -91,6 +91,7 @@ const Select = React.forwardRef(function Select(props, ref) { | |||
: classes, | |||
...(input ? input.props.inputProps : {}), | |||
}, | |||
...(multiple && variant === 'outlined' ? { notched: true } : {}), |
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.
Is there more context on this change?
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.
without the notched
prop, the label was strike through the fieldset border. My guess is that this has always been the case, but the combination (outlined + multiple) was never visible.
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.
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.
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.
Good catch on the first one. I was trying to fix the native
+ multiple
+ outlined
combo. Pushed a fix.
The second one is not related. It is "right" I believe, although it does not look very well. The example itself is quite extreme, as the width is very small (I guess in order to test the wrapping of the chips).
One more BC done 🙏 @petyosi thanks |
Breaking changes
[Select] Change default variant from standard to outlined ([Select][FormControl] Make outlined variant the default one #24895) @petyosi
Standard has been removed from the Material Design guidelines. This codemod will automatically update your code.
[FormControl] Change default variant from standard to outlined ([Select][FormControl] Make outlined variant the default one #24895) @petyosi
Standard has been removed from the Material Design guidelines. This codemod will automatically update your code.
Change the default variant from standard to outlined. Rationale in Material Studies: Text Fields. Done for TextField in #23503.
One of #20012
Checklist:
Select
componentChange the default variant of thebetter be done in a separate PR, not a small thing, IMONativeSelect
componentvariant
usage of theFormControl
and see if it is safe to change itChangedocs/pages/api-docs/select.json
(or maybe it is generated?)variant="outlined"
propsvariant="standard"
to selects who had no variant before<TextField select>
@mbrookes - please let me know if I am missing something from the above. FWIW, the biggest inconvenience of the outlined Select is that the
label
prop value should match theInputLabel
text.