From 3ea91eb6c70e3e7cb7c5506f80f54bb47df54f35 Mon Sep 17 00:00:00 2001 From: Nicolas KOKLA Date: Thu, 19 Dec 2024 14:53:14 +0100 Subject: [PATCH] Search Input : Support for 'enter' key (select the first purpose item) --- src/components/SearchBAN/search-input/SearchInput.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/SearchBAN/search-input/SearchInput.tsx b/src/components/SearchBAN/search-input/SearchInput.tsx index 3c7609f98..8f972bb85 100644 --- a/src/components/SearchBAN/search-input/SearchInput.tsx +++ b/src/components/SearchBAN/search-input/SearchInput.tsx @@ -69,12 +69,14 @@ export default function SearchInput({ } case useCombobox.stateChangeTypes.ItemClick: case useCombobox.stateChangeTypes.InputKeyDownEnter: - onSelect(changes.selectedItem) + console.log('selectedItem', changes.selectedItem, actionAndChanges?.props?.items?.[0], actionAndChanges) + const selectedValue = changes.selectedItem || actionAndChanges?.props?.items?.[0] + onSelect(selectedValue) return { ...changes, - ...(changes.selectedItem + ...(selectedValue ? { - inputValue: changes.selectedItem.properties.name, + inputValue: selectedValue.properties.name, } : null), }