Skip to content

Commit

Permalink
TAB should not trigger geocode if we just pressed ENTER
Browse files Browse the repository at this point in the history
  • Loading branch information
karussell committed Dec 6, 2024
1 parent 9f16994 commit 4e706ea
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/sidebar/search/AddressInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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
}
Expand Down

0 comments on commit 4e706ea

Please sign in to comment.