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

Touch events prevent default behavior such as scrolling #19

Open
Dzhyrma opened this issue Dec 1, 2018 · 1 comment
Open

Touch events prevent default behavior such as scrolling #19

Dzhyrma opened this issue Dec 1, 2018 · 1 comment

Comments

@Dzhyrma
Copy link

Dzhyrma commented Dec 1, 2018

I am using elm 0.19 and library version 3.1.0. I've assigned touch event on a sidebar to figure out when a left swipe occurs, but I've realized that scrolling is no longer working (only on mobile devices).

Right now I am using this:
Touch.onWithOptions "touchstart" { stopPropagation = False, preventDefault = False }
instead of:
Touch.onStart
to fix the problem. I think the default behavior shouldn't prevent default touch actions

@mpizenberg
Copy link
Owner

Hi @Dzhyrma, from my own experience, people who started using this library often did so because they needed access to coordinates of events, in the context of a drawing app or similar. Otherwise, creating one's own event listener is quite simple:

Html.Events.on "touchstart" (Decode.succeed SomebodyTouchedThatMsg)

In that context, it can be very surprising when touch or pointer events get cancelled because a touch action (swipe, scroll, ...) was detected by the browser. It's super hard to take decisions with very few data points so I prioritized use cases similar to mine. That's the reason why I defaulted to prevent default. Let me know if you don't find this convincing ^^!

Sorry for the delayed answer, I've been busy these days and don't have much time for personal projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants