Skip to content

Commit 5e61940

Browse files
committed
fix like we did for normal entries also needed for recent (c7629bd)
1 parent 151246d commit 5e61940

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/sidebar/search/AddressInput.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ export default function AddressInput(props: AddressInputProps) {
177177

178178
// do not focus on mobile as we would hide the map with the "input"-view
179179
const focusFirstInput = props.index == 0 && !isSmallScreen
180+
const isInitialFocus = useRef(focusFirstInput)
180181

181182
return (
182183
<div className={containerClass}>
@@ -232,7 +233,9 @@ export default function AddressInput(props: AddressInputProps) {
232233
onFocus={() => {
233234
setHasFocus(true)
234235
props.clearDragDrop()
235-
if (text === '') {
236+
if (isInitialFocus.current) {
237+
isInitialFocus.current = false
238+
} else if (text === '') {
236239
const recents = buildRecentItems(undefined, 5, excludeCoord)
237240
if (recents.length > 0) setAutocompleteItems(recents)
238241
}
@@ -299,6 +302,7 @@ export default function AddressInput(props: AddressInputProps) {
299302
props.onAddressSelected(item.toText(), item.point)
300303
saveRecentLocation(item.mainText, item.secondText, item.point)
301304
} else if (item instanceof RecentLocationItem) {
305+
setText(item.toText())
302306
props.onAddressSelected(item.toText(), item.point)
303307
} else if (item instanceof POIQueryItem) {
304308
handlePoiSearch(poiSearch, item.result, props.map)

0 commit comments

Comments
 (0)