Merge pull request #33534 from overleaf/em-fix-autocomplete-32913

Fix autocomplete dropdown closing on blur and input re-click

GitOrigin-RevId: 82f45f0f1ae9e2b3846906d962a3f16e5b2963e4
This commit is contained in:
Eric Mc Sween
2026-05-11 08:06:11 +00:00
committed by Copybot
parent 893005cb88
commit e0488a8d3b
2 changed files with 33 additions and 0 deletions
@@ -33,6 +33,7 @@ export type OLAutocompleteProps = {
inputRef?: React.ForwardedRef<HTMLInputElement>
expandUp?: boolean
onClose?: () => void
isOpen?: boolean
}
type OLAutocompleteDisplayItem =
@@ -59,6 +60,7 @@ function OLAutocompleteInternal({
inputRef,
expandUp = false,
onClose,
isOpen: controlledIsOpen,
}: OLAutocompleteProps) {
const { t } = useTranslation()
@@ -140,6 +142,7 @@ function OLAutocompleteInternal({
inputValue: internalInputValue,
items: displayItems,
defaultHighlightedIndex: 0,
...(controlledIsOpen !== undefined && { isOpen: controlledIsOpen }),
itemToString: item => {
if (!item) return ''
return item.type === 'create' ? item.inputValue : item.label