Skip to content

Commit a450773

Browse files
committed
AutocompleteTextarea: fix justAutocompleted calculation
1 parent 0841430 commit a450773

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

app/ui/AutocompleteTextarea.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,11 @@ export const AutocompleteTextarea = forwardRef<HTMLTextAreaElement, Props>(
4242
const autocompleteItems = queryState ? getAutocompleteItems(queryState, modes) : []
4343
const [autocompletePosition, setAutocompletePosition] = useState({ x: 0, y: 0 })
4444

45-
// If the only autocomplete item is the current query, we've either typed out a valid
45+
// If the first or only autocomplete item is the current query, we've either typed out a valid
4646
// item by hand, or we just selected it. In either case, we should not show the autocomplete.
4747
const justAutocompleted =
4848
queryState !== undefined &&
49-
queryState.query.length > 0 &&
50-
autocompleteItems.length === 1 &&
51-
autocompleteItems[0] === queryState.query
49+
autocompleteItems[0].toLowerCase() === queryState.query.toLowerCase()
5250

5351
// show the autocomplete if the user is typing a query and there are items to show
5452
const showAutocomplete =

0 commit comments

Comments
 (0)