jerrybendy / vue-touch-events

Support simple touch events (tap / swipe / touch hold)
MIT License
537 stars 51 forks source link

[Desktop] swipe event fires on incorrectly desktop and non-touch devices #99

Open wparad opened 1 year ago

wparad commented 1 year ago

Swipe events should never fire on devices that aren't touch screens.

jerrybendy commented 1 year ago

Yes you are right, and this is the desired result.

wparad commented 1 year ago

Can you explain why that makes sense, so we can have a better understanding of the intention?

The expectation for our users is that on mobile, a swipe touch event is necessary, but on desktop this breaks the whole experience. When a user on desktop attempts to copy text from the screen, the swipe activates, which is a huge problem.

jerrybendy commented 1 year ago

I got your problem. How about add a new option to disable swipe on desktop? Or anything better?

wparad commented 1 year ago

Works for me, I'd honestly make it the default. There's something confusing about drag versus swipe. But I haven't really dug into all the details.

Would this have to be a new v- type or a some property added to the end of swipe... v-touch.swipe-mobile.left=...?

jerrybendy commented 1 year ago

I prefer to make things common, so I think swipe-mobile is not a good choice. Maybe disableSwipeOnDesktop? I have no idea. Could you give me more advice?

wparad commented 1 year ago

My advice would be for this not to be an option at all. In reality the swipe action should only trigger on devices that have touch. If the device does not have touch swipe doesn't make sense. click, drag, etc.. all still make sense, but swipe not. Is there some way you can dynamically figure out if the device is a touch device and only run the event on there?