File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments