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

Demo page and touch functionality not working on mobile Android #239

Closed
jasonpang opened this issue Oct 21, 2015 · 14 comments
Closed

Demo page and touch functionality not working on mobile Android #239

jasonpang opened this issue Oct 21, 2015 · 14 comments
Labels

Comments

@jasonpang
Copy link

Dragula seems like an excellent library, but I couldn't find anything on the documentation or previously opened issues for whether mobile Android was supported.

When I tried out the demo page, I wasn't able to use the drag and drop functionality. I tried long-pressing, pressing, scrolling, and pinching, but none of this worked.

Is there a flag I have to turn on, or is mobile Android not supported?

@jasonpang
Copy link
Author

Strangely enough, react-dragula's demo does work, while both the main dragula's demo and angular-dragula's demo does not work on Android. Using Android 5.1.1 with latest Chrome browser.

@daisythephoenix
Copy link

I couldn't get the demo page to work on Mobile web either.

@bevacqua bevacqua added the bug label Oct 22, 2015
@bevacqua
Copy link
Owner

Sounds like a bug. Could you try and pinpoint the issue?

@daisythephoenix
Copy link

Thanks for the prompt reply. All I did was to open the demo page (http://bevacqua.github.io/dragula/) on the mobile browsers (I tried chrome and safari) on my phone (6s, ios 9.0.2). None of the example works.

@daisythephoenix
Copy link

I also thought my phone was broken. Then I tried another drag-n-drop plug in and it worked (http://rubaxa-sortable.meteor.com). Thanks!

@MaxxWyndham
Copy link
Contributor

@bevacqua

I've found three places that needed changing to get the current version to play nice on android:

  1. https://github.com/bevacqua/dragula/blob/master/dist/dragula.js#L134
var ignore = whichMouseButton(e) !== 1 || e.metaKey || e.ctrlKey;

changed to

var ignore = (e.which !== 0 && e.which !== 1) || e.metaKey || e.ctrlKey;
  1. https://github.com/bevacqua/dragula/blob/master/dist/dragula.js#L158
if (whichMouseButton(e) === 0) {

changed to

if (e.which !== 0 && e.which !== 1) {
  1. https://github.com/bevacqua/dragula/blob/master/dist/dragula.js#L162-L164
if (e.clientX === _moveX && e.clientY === _moveY) {
  return;
}

commented out (e.clientX is undefined, as is _moveX)

//if (e.clientX === _moveX && e.clientY === _moveY) {  
//    return;  
//}  

The alternate whichMouseButton logic I lifted from the react-dragula demo page. I have no idea if these changes work on iOS or what side-effects they may cause. Hope this helps.

@bevacqua
Copy link
Owner

Note that that logic was used for fixes in 3.5.1. If we can preserve those fixes then go ahead and submit a PR.

https://github.com/bevacqua/dragula/blob/master/changelog.markdown#351-which-hunt

@MaxxWyndham
Copy link
Contributor

PR submitted: #240
Let me know if I've made any sort of faux pas. Theoretically this covers #236 but I have no way of testing that.

@jasonpang
Copy link
Author

Holy crap you guys are fast...

@daisythephoenix
Copy link

Thank you!!! @MaxxWyndham and @bevacqua Is the Meteor package updated automatically as well? Or should I just try with a script link included in the header?

@MaxxWyndham
Copy link
Contributor

@bevacqua Is there anything else I need to do?

@mrspaularich
Copy link

Hi there, I am looking for a drag and drop that works on both desktop and mobile and dragula looks great and seems to fit the bill. Are there any updates on when or if this fix will be included?

@bevacqua
Copy link
Owner

bevacqua commented Nov 3, 2015

Resolved in 3.5.3

@bevacqua bevacqua closed this as completed Nov 3, 2015
@yarimadam
Copy link

I was waiting for it. Thank you very much. @bevacqua

danielpspring added a commit to danielpspring/dragula that referenced this issue Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants