Merge pull request #917 from sharetribe/fix-mobile-touch-default-action

Fix LocationAutocompleteInput's events that cause clicks
This commit is contained in:
Vesa Luusua 2018-09-05 17:15:40 +03:00 committed by GitHub
commit a54b1c8b8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 6 deletions

View file

@ -11,7 +11,9 @@ way to update this template, but currently, we follow a pattern:
* Patch (v0.0.**X**): Bug fixes and small changes to components.
---
## Upcoming version 2018-08-XX
## Upcoming version 2018-09-XX
* [fix] Touch event from location autocomplete prediction list ended up causing clicks.
[#917](https://github.com/sharetribe/flex-template-web/pull/917)
* [change] Disable default predictions in listing wizard
[#906](https://github.com/sharetribe/flex-template-web/pull/906)

View file

@ -64,11 +64,26 @@ const LocationPredictionsList = props => {
<li
className={isHighlighted ? css.highlighted : null}
key={predictionId}
onTouchStart={e => onSelectStart(getTouchCoordinates(e.nativeEvent))}
onMouseDown={() => onSelectStart()}
onTouchMove={e => onSelectMove(getTouchCoordinates(e.nativeEvent))}
onTouchEnd={() => onSelectEnd(prediction)}
onMouseUp={() => onSelectEnd(prediction)}
onTouchStart={e => {
e.preventDefault();
onSelectStart(getTouchCoordinates(e.nativeEvent));
}}
onMouseDown={e => {
e.preventDefault();
onSelectStart();
}}
onTouchMove={e => {
e.preventDefault();
onSelectMove(getTouchCoordinates(e.nativeEvent));
}}
onTouchEnd={e => {
e.preventDefault();
onSelectEnd(prediction);
}}
onMouseUp={e => {
e.preventDefault();
onSelectEnd(prediction);
}}
>
{predictionId === CURRENT_LOCATION_ID ? (
<span className={css.currentLocation}>