Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix touch support. #169

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Fix touch support. #169

wants to merge 2 commits into from

Conversation

taliastocks
Copy link

Fix touch support. In case we are dragging something clickable, preventDefault on drag, not on mousedown/touchstart.

…ntDefault on drag, not on mousedown/touchstart.
@taliastocks
Copy link
Author

I have not recompiled the minified version of the script. I assume you have a process for doing that.

@@ -86,6 +86,7 @@
// The Placeholder has not been moved yet.
onDrag: function ($item, position, _super, event) {
$item.css(position)
event.preventDefault()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On mobile, this prevents the page from scrolling while dragging an object.

@klemens-u
Copy link

Hi, thanks for the patch but I've got a problem with it:

On touch devices like iPad or Android I experienced a problem:
I've got the following markup:
ul
li
a href=xyz

Clicking on links works now with your patch, also the dragging works, but when dropping the link is clicked instead of firing the onDrop event.

Any idea?

@taliastocks
Copy link
Author

Hmm, I'm not sure. Feel free to investigate. I didn't end up using this library for the feature I was working on, after all, so I don't have a lot invested in debugging this anymore.

ycatch added a commit to ycatch/mameblock.js that referenced this pull request Jan 9, 2016
Fix touch support. #169 for jquery-sortable

Fix touch support. In case we are dragging something clickable,
preventDefault on drag, not on mousedown/touchstart by collinstocks.

johnny/jquery-sortable#169

This is support for FirefoxOS
@ycatch
Copy link

ycatch commented Jan 9, 2016

Hi. This is great Fix!
I was successful it on FirefoxOS.

@LukeTowers LukeTowers mentioned this pull request Nov 28, 2019
LukeTowers referenced this pull request in octobercms/october Nov 28, 2019
@devmotionfr
Copy link

devmotionfr commented Mar 4, 2021

If anyone is having this error in console :
[Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive

Just add touch-action: none; to the css of the ul or ol to fix it

@dugwood
Copy link

dugwood commented Mar 4, 2021

@devmotionfr I've used html { touch-action: manipulation; } to do it for the whole page. I don't remember exactly why though... And just added a comment that touch-action: pan-x will prevent the whole page to be scrolled (that should have been a solution for this warning when it first appeared).

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.

5 participants