Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onClick isn't triggered for touch devices #364

Merged
merged 3 commits into from
Nov 2, 2023
Merged

onClick isn't triggered for touch devices #364

merged 3 commits into from
Nov 2, 2023

Conversation

karussell
Copy link
Member

@karussell karussell commented Nov 1, 2023

Fixes #363. To be tested on multiple devices here ... e.g. it should not trigger a click into a different input afterwards.

The onBlur-pointerDownOnSuggestion workaround is only necessary for onClick but not if we use onMouseDown And the onClick of AutocompleteEntry somehow isn't triggered for touch devices although it should - maybe the onBlur event is the problem here too. Regardless of this: if we use onTouchStart={()=>onSelect()} (or onTouchEnd) it seems works on touch devices too. i.e. we can fix the issue and remove the onBlur-pointerDownOnSuggestion workaround via using onPointerDown instead of onClick.

Update: no. The UX is ugly when using onPointerDown as the finger is then still on the screen (or mouse is down) triggering wrong things like adding more locations (i.e. clicking elements underneath the autocomplete box). Using onPointerUp seems to avoid these problems and still provide a single working method for mouse+touch.

Update: We should use our old pointer-event-cancel method as it is less code. Somehow the "touch cancellation" does not work -> remove that for now (even less code).

@karussell karussell added this to the 0.6 milestone Nov 2, 2023
@karussell karussell merged commit 7950a2f into master Nov 2, 2023
2 checks passed
@karussell karussell deleted the issue_363 branch November 2, 2023 17:06
ZeroGxMax pushed a commit to minhhpkp/graphhopper-maps that referenced this pull request Nov 12, 2024
* onClick isn't triggered for touch devices, graphhopper#363

* reintroduce pointerdown workaround but make it explicitely only for mousedown

* use original solution but without setIsCancelled as this prevention does not seem to work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

autocomplete selection broken for touch devices on non-mobile view
1 participant