Jump to content
Search Community

startDrag bug in chrome touch events

Sahil test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi,

 

I encountered a bug while using draggable's startDrag method. The issue can be seen in both, mobile and Chrome developers tools, with no problems in firefox.

 

In demo if you use trigger to drag target, it behaves correct on first drag but on subsequent drags it jumps back to start position and keeps stuttering instead of dragging. I stopped listening to mousedown event but no changes.

 

UPDATE: It also ignores onStart callback on subsequent drags, and if you drag few times, the target element also takes few attempts before it starts responding to direct drags.

 

See the Pen baaLZR?editors=0110 by Sahil89 (@Sahil89) on CodePen

Link to comment
Share on other sites

  • Sahil changed the title to startDrag bug in chrome touch events

Hm, I tried reproducing this in Chrome and Safari but had no luck. You're saying that if I press/drag "Trigger" multiple times, it only works properly the first time but on all subsequent drags, it jumps back to the start and then stutters? Can anyone else reproduce this? @Sahil what version of the browsers are you testing it on? 

Link to comment
Share on other sites

Thanks Jack. On Android i am using Chrome 63.0.3239.111. On windows, Chrome 63.0.3239.132 (Official Build) (64-bit) same behavior can be seen while emulating touch events from developer tools.

 

Following video shows behaviour on same demo. I first noticed it while creating demo for other thread.

 

 

Link to comment
Share on other sites

I can reproduce the problem, but it's not a Draggable issue.

 

Always use PointerEvents when available. IE and Edge do not not have touch events, and never will. And you need to add touch-action to your CSS. This article does a really good job of showing how to work with touch.

https://developers.google.com/web/fundamentals/design-and-ux/input/touch/

 

With PointerEvents and touch-action on the trigger...

 

See the Pen rpJVGJ by osublake (@osublake) on CodePen

 

 

  • Like 4
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...