Autocomplete crash in multiple selection mode #18221
Labels
bug 🐛
Something doesn't work
component: autocomplete
This is the name of the generic UI component, not the React module!
good first issue
Great for first contributions. Enable to learn the contribution process.
When multiple selections are enabled on an Autocomplete component, it's possible to crash the component by
Enter
This can be duplicated on the Autocomplete demo page.
Current Behavior 😯
I am using a similar
getOptionLabel
function as the demo page, where the title property of the given option is returned as the label. Instead of theEnter
keypress being ignored when no value is selected, anundefined
filter value is passed along and thegetOptionLabel
can't resolve a property of an undefined error.Expected Behavior 🤔
Empty filter values should short-circuit long before the
getOptionLabel
function is called.Steps to Reproduce 🕹
See above.
Context 🔦
A workaround for this looks like this in code:
and this in the Autocomplete text field...
... which is nasty.
Your Environment 🌎
As mentioned above, this happens on the Autocomplete demo page using Chrome 78. This seems like a pretty straightforward bug.
The text was updated successfully, but these errors were encountered: