ui: autocomplete: focus on the first item when `!freeSolo` (#381)

pull/384/head
无限UCW 2 years ago committed by GitHub
parent af19d83111
commit dee229dcf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -121,7 +121,7 @@ const AutoComplete = forwardRef(function Impl<T>(props: AutoCompleteProps<T>, re
if (!queryCache[query]) queryCache[query] = await queryItems(query);
for (const item of queryCache[query]) valueCache[itemKey(item)] = item;
setItemList(queryCache[query]);
setCurrentItem(null);
setCurrentItem((!freeSolo && queryCache[query].length > 0) ? 0 : null);
};
const dispatchChange = () => {

Loading…
Cancel
Save