From 5c0d094271601331cbf5b8aec2112a0a5a24718b Mon Sep 17 00:00:00 2001 From: Marine Picaut Date: Tue, 17 Dec 2019 14:45:51 +0100 Subject: [PATCH] [Autocomplete] Validate freeSolo input (with multiple) (mui-org#18656) --- .../src/useAutocomplete/useAutocomplete.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js b/packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js index 85636b90ab2cce..dee790c99abadd 100644 --- a/packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js +++ b/packages/material-ui-lab/src/useAutocomplete/useAutocomplete.js @@ -639,6 +639,10 @@ export default function useAutocomplete(props) { const handleInputChange = event => { const newValue = event.target.value; + if (onInputChange) { + onInputChange(event, newValue, 'input'); + } + if (newValue === '') { if (disableOpenOnFocus) { handleClose(event); @@ -656,10 +660,6 @@ export default function useAutocomplete(props) { } setInputValue(newValue); - - if (onInputChange) { - onInputChange(event, newValue, 'input'); - } }; const handleOptionMouseOver = event => {