mui / material-ui

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
https://mui.com/material-ui/
MIT License
93.76k stars 32.24k forks source link

[SSR] Incorrect styles for InputLabel if input not empty #36238

Open SiarheiLazakovich opened 1 year ago

SiarheiLazakovich commented 1 year ago

Duplicates

Latest version

Steps to reproduce 🕹

Link to live example: https://codesandbox.io/s/vigorous-bessie-pcu4j4

based on https://github.com/mui/material-ui/tree/master/examples/material-next-ts extended with example https://mui.com/material-ui/react-autocomplete/#controlled-states (with initial inputValue)

Current behavior 😯

InputLabel styled for unfilled input in SSR response when input not empty.

Expected behavior 🤔

InputLabel has correct styles in SSR response when input not empty.

Context 🔦

No response

Your environment 🌎

No response

SiarheiLazakovich commented 1 year ago

same on https://mui.com/x/react-date-pickers/getting-started/ page

mnajdova commented 1 year ago

Thanks, we'll need to dive a bit deeper to see what's the problem. As a workaround you can use shrink: true in the InputLabelProps, see: https://codesandbox.io/s/condescending-lumiere-ryv982?file=/src/ControllableStates.tsx Similar to https://github.com/mui/material-ui/issues/32466

SiarheiLazakovich commented 1 year ago

@mnajdova, Thanks!