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

This commit is contained in:
无限UCW authored and GitHub committed 2022-07-03 00:46:28 +08:00
1 parent af19d83111
commit dee229dcf3
1 file changed
+1 -1
@@ -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 = () => {