jQuery-Touch-Events icon indicating copy to clipboard operation
jQuery-Touch-Events copied to clipboard

Swipe event not working with touch screen in Microsoft Edge.

Open toshiya14 opened this issue 4 years ago • 4 comments

My User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36 Edg/89.0.774.45

Issue Description: I use your library in my project, the swipeleft and swiperight event not triggered in my project with touch screen in Microsoft Edge, but the touch gesture function of the browser happens. I have also tried your Demo, the behavior is the same. It is the same issue if I use Chrome with a real touch screen.

I have tried to add $([the same selector]).on("touchstart", e => { e.preventDefault(); } to my page, the touch gesture is not triggered any more. But the swipe related events not response as well.

It works fine with mouse operation and F12 mouse emulated touch operation. But not works with a real touch screen.

toshiya14 avatar Mar 05 '21 06:03 toshiya14

Are you saying that even calling on('touchstart') does not trigger anything?

I would imagine that it's related to https://github.com/benmajor/jQuery-Touch-Events/issues/166. What is the physical device that you are trying on?

benmajor avatar Mar 05 '21 07:03 benmajor

Are you saying that even calling on('touchstart') does not trigger anything?

I would imagine that it's related to #166. What is the physical device that you are trying on?

I am using a monitor with touch support via USB to my desktop. I think it would use the common touch driver just like a Windows tablet such as Microsoft Surface Pro.

toshiya14 avatar Mar 05 '21 09:03 toshiya14

I have tried to fix the problems and write the events by myself. And this version does work.

https://codepen.io/toshiya14/pen/PobBywd

  • Use e.preventDefault() in on(touchstart) and then process the logic seems work fine.
  • If I do not add style touch-action: none, I got an Error: Unable to preventDefault inside passive event listener due to target being treated as passive.
  • Add e.preventDefault() to on(touchend) might prevent the mouse events.

I hope this codes might help to fix this issue.

toshiya14 avatar Mar 05 '21 10:03 toshiya14

Okay, thanks. I will take a look at the differences and see what the possible issue is.

benmajor avatar Mar 05 '21 10:03 benmajor