Skip to content

Commit

Permalink
Search Input : Support for 'enter' key (select the first purpose item)
Browse files Browse the repository at this point in the history
  • Loading branch information
nkokla committed Dec 19, 2024
1 parent 55a1199 commit 3ea91eb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/SearchBAN/search-input/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down

0 comments on commit 3ea91eb

Please sign in to comment.