Mouse: Fix for binding touch events to mouse events (like UI Touch Punch) with Draggable #735

Closed
wants to merge 1 commit into
from

Projects

None yet

5 participants

@pcvandam
pcvandam commented Oct 3, 2012

Using any touch to mouse extension, like UI Touch Punch, will create empty ghost events in Draggable. Patch checks for these and cancels.

@pcvandam pcvandam Update ui/jquery.ui.mouse.js
Using any touch to mouse extension, like UI Touch Punch, will create empty ghost events in Draggable. Patch checks for these and cancels.
a3771da
@scottgonzalez
Member

Why does it generate ghost events and why is it our responsibility to fix their erroneous events?

@pcvandam
pcvandam commented Oct 3, 2012

I'm not sure. It isn't their bug, it is the mouse handler (or draggable) that is creating these events. Or perhaps it is an Safari iPad bug.

It cannot be fixed on the level of the extension it seems, but this simple fix cures it for all touch conversion-related extensions.

Do you want an extended test case?

@scottgonzalez
Member

@furf do you know what's going on here?

@scottgonzalez
Member

@pcvandam You're saying that jQuery UI is generating additional events? If so, can you point to where that generation is occurring?

@furf
furf commented Oct 5, 2012

@pcvandam which ghost events are you seeing?

can you provide an extended use case? feel free to use this fiddle as a starting point: http://jsfiddle.net/bmL4L/3/

@pcvandam
pcvandam commented Oct 8, 2012

Sorry for the delay.

Eventually I found the unlikely culprit: cursor: 'move' in Draggable. Setting this directive causes the iPad Safari with Touch Punch to create the extra empty mouse-events.

http://jsbin.com/eqodow/1

You can easily test with the iPad simulator and see the 'flash' where it tries to move to the faulty location. Removing cursor: 'move' fixes this issue. Or you can filter the erroneous events from ui.mouse as in my commit, but that might not be the best fix as I look at it now.

@jzaefferer
Member

@furf @pcvandam so is this something touchpunch can address? Otherwise we should just land this for 1.9.1. The interaction redesign will invalidate the whole context eventually.

@mikesherov
Member

any progress here @pcvandam, @furf, @jzaefferer ?

@mikesherov
Member

Thanks for this patch! I'm not so sure see why we should be fixing this, though. I'm going to close this pull request, and will reopen it if we here back from @furf saying there is no reasonable way to fix this in touchpunch. Thanks again everyone.

@mikesherov mikesherov closed this Nov 27, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment