Skip to content

Conversation

@RandScullard
Copy link

The reason scrolling wasn't working was because simulateMouseEvent was always calling preventDefault on the original touch event. This version instead calls preventDefault on the touch event only if the widget calls preventDefault on the simulated mouse event. This allows scrolling and dragging to both work on the same element. Tested with Sortable, Draggable, and Resizable.

…lt on touchstart. This avoids duplicating mouse events that the browser simulates on its own. Also improve the code to distinguish between a click and a move.
@Slumber86
Copy link

This fix broke calendars dropdowns on android 4.x

@bbmatt
Copy link

bbmatt commented May 7, 2015

The fix works, but will throw an error on first initialisation when using a mouse instead of touch.
I fixed that by requiring touchEvent on lines 209 & 226 of your fix:

if (event.isDefaultPrevented() && touchEvent)

@RandScullard
Copy link
Author

Good catch, @bbmatt. I have updated the pull request with your fix. That problem didn't show up in my application because I only load jquery-ui-touch-punch on touch-only platforms. 😞

…hat supports touch events, causing touchEvent to be undefined in _mouseDown and _mouseMove.
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

Successfully merging this pull request may close these issues.

3 participants