From 4e706ea47e4ae99f3660ee9854b7c91c04b6b906 Mon Sep 17 00:00:00 2001 From: Peter Date: Fri, 6 Dec 2024 22:50:18 +0100 Subject: [PATCH] TAB should not trigger geocode if we just pressed ENTER --- src/sidebar/search/AddressInput.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sidebar/search/AddressInput.tsx b/src/sidebar/search/AddressInput.tsx index c6758368..5c83fe41 100644 --- a/src/sidebar/search/AddressInput.tsx +++ b/src/sidebar/search/AddressInput.tsx @@ -127,7 +127,7 @@ export default function AddressInput(props: AddressInputProps) { if (item instanceof POIQueryItem) { handlePoiSearch(poiSearch, item.result, props.map) props.onAddressSelected(item.result.text(item.result.poi), undefined) - } else if (highlightedResult < 0) { + } else if (highlightedResult < 0 && !props.point.isInitialized) { // by default use the first result, otherwise the highlighted one getApi() .geocode(text, 'nominatim') @@ -144,6 +144,7 @@ export default function AddressInput(props: AddressInputProps) { props.onAddressSelected(item.toText(), item.point) } } + // do not disturb 'tab' cycle if (event.key == 'Enter') searchInput.current!.blur() break }