material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

[material-ui][Select] Fix autoWidth sizing with InputLabel

Open FGFAnderson opened this issue 9 months ago • 2 comments

Fixes #45276

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 the autoWidth prop from <Select> possibly using <FormControls> useFormControl() hook which seemed like a lot but could be used.

FGFAnderson avatar Apr 09 '25 23:04 FGFAnderson

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

mui-bot avatar Apr 10 '25 11:04 mui-bot

@siriwatknp Can you review this?

ZeeshanTamboli avatar Nov 07 '25 05:11 ZeeshanTamboli