material-ui
material-ui copied to clipboard
[material-ui][Select] Fix autoWidth sizing with InputLabel
Fixes #45276
- [x] I have followed (at least) the PR section of the contributing guide.
The implementation of this doesn't quite feel right but the other alternative options I considered had their own problems:
- The only way to accurately measure the size of a string would be to render it hidden and take the width and set minWidth to that.
-
<InputLabel>doesn't resize the the Select as it's position is absolute, changing this could have consequences of which I don't know - To change
<InputLabel>to size the Select we would need to get theautoWidthprop from<Select>possibly using<FormControls>useFormControl()hook which seemed like a lot but could be used.
Netlify deploy preview
https://deploy-preview-45862--material-ui.netlify.app/
Bundle size report
Details of bundle changes (Toolpad) Details of bundle changes
Generated by :no_entry_sign: dangerJS against 50bf65394b9dd907f62e885ee53145fcc6714893
@siriwatknp Can you review this?