Suggestion: Add a hint for mobile and draggable to use `touch-action: none;`
See original GitHub issueDraggable on mobile triggers onend
before you let go of your finger. That may happen when the page has scroll and the phone scroll interferes with the item dragging.
To prevent that from happening you need this style on your container
.container {
touch-action: none;
}
My suggestion is to include this information somewhere in the examples/docs.
I spent quite some time trying to figure out why it wasn’t working.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:27
- Comments:9
Top Results From Across the Web
touch-action - CSS: Cascading Style Sheets - MDN Web Docs
The touch-action CSS property sets how an element's region can be ... Enable browser handling of all panning and zooming gestures. none.
Read more >touch-action - CSS-Tricks
The touch-action property in CSS gives you control over the effect of touchscreen interactions with an element, similar to the more ...
Read more >How to Use Touch Actions in Appium: Swipe Tap Touch
Hi all, in this article, I will answer this question and share with you the details of how to do some appium mobile...
Read more >Prevent page scroll on drag in IOS and Android - Stack Overflow
The preferred solution is to use the CSS style touch-action to specify that no scrolling should happen (e.g. with the value "none").
Read more >Part 6 - Appium Latest Tutorials - Mobile Gestures - Android ...
Part 6 - Appium Latest Tutorials - Mobile Gestures - Android Touch Action - Tap - Long Press.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
THANK YOU for this. Also, a tip for others - it works fine to add this css to whatever is being dragged as opposed to the container:
For anyone still struggling with this, I had a horizontal slider which I enabled with draggable. On mobile I got the buggy behaviour which was fixed by using
touch-action: none;
.But this caused the page to be unscrollable on the element with that property, meaning the user could get stuck if that element almost or completely covered the viewport. I solved it by using a combination of the
startAxis: 'x'
option for draggable and settingtouch-action: pan-y;
on the element. In this way, the only dragging catched by interact.js would be horizontally and the only scrolling catched by the browser would be vertically.See: https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action