[Autocomplete] Label is shrinked when providing an empty array as a value
to Autocomplete when using multiple
and renderValue
#46037
Labels
component: autocomplete
This is the name of the generic UI component, not the React module!
regression 🐛
A bug, but worse
Steps to reproduce
Steps:
true
instead offalse
.Current behavior
An autocomplete with
multiple
set to true andvalue
set to[]
renders the input label withdata-shrink="true"
instead offalse
.Expected behavior
The data-shrink should be
false
if the controlled value is[]
.Context
Recent change in 7.0.2 (PR: #45734) prevents the shrink animation to run if an initial value for the autocomplete is given. The PR didn't account for
multiple
variant of the autocomplete when the user can pass[]
- this should be considered as an empty value and the shrink animation should run.For the controlled autocomplete with
multiple
set tofalse
, everything works as expected and if the user sets the value to""
, then thedata-shrink
isfalse
very likely because""
is a falsy value. For multiple set totrue
, the[]
is not a falsy value and probably breaks the behaviour.Your environment
npx @mui/envinfo
Tested on Brave (Chromium 135) and Firefox 137
Search keywords: shrink autocomplete multiple
The text was updated successfully, but these errors were encountered: