mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user