graphhopper/graphhopper-maps

Sometimes clicking on an item in the autocomplete list is broken

Closed this issue · 1 comments

  1. Sometimes when I click on an item in the autocomplete list (in firefox) it shows the marker on the map but won't change the input with the text of the item. It is currently reproducible when I initially have this URL and type 'hoyersw' in the first input field and click on the first result of the autocomplete (which would be the same text as in the URL Hoyerswerda - Wojerecy).

  2. On mobile there is a similar but more critical issue as because of this problem the location is not even shown on the map. I had the feeling that this happened for lighter touches (!?)

Update: the 2nd problem seems to be that we have a special handling for touch events in AutocompleteEntry. I think instead we should rely on onclick even for mobile devices because an additional click event is additionally generated (by the browser) for certain touch events (with unchanged x+y position).

But currently this additional click event is not created because:

  1. the onBlur method of AddressInput interferes and
  2. we call e.preventDefault() for onPointerDown in AutocompleteEntry.

(For onBlur: because setHasFocus(false) hides the suggestion just before the touchend is created and therefor the autocomple item is "moved away under the finger" and the click event isn't generated. To see what is going on you can trigger the click event when removing all touch and pointer related handling in AutocompleteEntry and then removing the onBlur method. )

Update: was able to debug the 2nd problem on a mobile device (with eruda) and it seems that no onTouchEnd and no onClick is called when this happens (only touchStart+pointerDown). Maybe this is just a firefox problem? I was able to reproduce this on another Android device with firefox, but not yet on chrome.

The second part should be fixed via #357 (or #354 before). Created a new issue for the first part: #358