File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -184,7 +184,7 @@ export default function AddressInput(props: AddressInputProps) {
184184 < PlainButton
185185 className = { styles . btnClose }
186186 onMouseDown = { ( e ) =>
187- e . preventDefault ( ) // prevents that input->onBlur is called when just "mouse down" event (lose focus only for a proper click )
187+ e . preventDefault ( ) // prevents that input->onBlur is called when just "mouse down" event (lose focus only for onClick )
188188 }
189189 onClick = { ( ) => searchInput . current ! . blur ( ) }
190190 >
@@ -231,7 +231,7 @@ export default function AddressInput(props: AddressInputProps) {
231231 onClick = { ( e ) => {
232232 setText ( '' )
233233 props . onChange ( '' )
234- // if we clear the text without focus then explicitely request it:
234+ // if we clear the text without focus then explicitly request it to improve usability :
235235 searchInput . current ! . focus ( )
236236 } }
237237 >
@@ -269,7 +269,7 @@ export default function AddressInput(props: AddressInputProps) {
269269 handlePoiSearch ( poiSearch , item . result , props . map )
270270 setText ( item . result . text ( item . result . poi ) )
271271 }
272- searchInput . current ! . blur ( ) // is called in combination with e.preventDefault in AutocompleteEntry->onMouseDown
272+ searchInput . current ! . blur ( ) // see also AutocompleteEntry->onMouseDown
273273 } }
274274 />
275275 </ ResponsiveAutocomplete >
Original file line number Diff line number Diff line change @@ -108,16 +108,17 @@ function AutocompleteEntry({
108108 return (
109109 < button
110110 className = { className }
111- onMouseDown = { e => {
112- e . preventDefault ( ) // prevent blur event for our input, see #398
113- } }
114111 // using click events for mouse interaction and touch end to select an entry.
115112 onClick = { ( ) => onSelect ( ) }
116113 // minor workaround to improve success rate for click even if start and end location on screen are slightly different
117114 onTouchEnd = { e => {
118115 e . preventDefault ( ) // do not forward click to underlying component
119116 onSelect ( )
120117 } }
118+ onMouseDown = { e => {
119+ e . preventDefault ( ) // Prevent blur event for our input, see #398.
120+ // See also the onMouseDown calls in the buttons in AddressInput.tsx created for the same reason.
121+ } }
121122 >
122123 { children }
123124 </ button >
You can’t perform that action at this time.
0 commit comments