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

Same element with both Draggable and Click / Touch #250

Closed
anandpdoshi opened this issue Jan 28, 2015 · 14 comments
Closed

Same element with both Draggable and Click / Touch #250

anandpdoshi opened this issue Jan 28, 2015 · 14 comments
Labels

Comments

@anandpdoshi
Copy link

I have a set of icons which can be dragged for sorting or clicked for going into the link. This works on desktop browsers, but on touch devices, only dragging works. Touch event does not go through.

This is the error that occurs on double tap:
screen shot 2015-01-28 at 6 59 02 pm

Here's what the UI looks like:
screen shot 2015-01-28 at 6 59 56 pm

You can try out the live demo here: http://staging5.erpnext.com/

@RubaXa RubaXa added the bug label Feb 6, 2015
RubaXa added a commit that referenced this issue Feb 6, 2015
@RubaXa
Copy link
Collaborator

RubaXa commented Feb 6, 2015

Try dev-branch

@RubaXa
Copy link
Collaborator

RubaXa commented Feb 9, 2015

@anandpdoshi ?

@anandpdoshi
Copy link
Author

@RubaXa Thanks for getting back.
dev branch didn't work. I am getting the same error in the console as the 1st screenshot.

For now, I have disabled dragging on touchscreen devices using the code:

    if ('ontouchstart' in window) {
        return;
    }

@bustikiller
Copy link

Good afternoon,

This is also happening to me. I've got a div which should be dragged or clicked. However, the drag event is always fired but the click event is never fired. A fix would be so great ;)

Nice job!

@RubaXa
Copy link
Collaborator

RubaXa commented Feb 12, 2015

@anandpdoshi Here is an example of work dev-branch, there is no error, the problem maybe due to use min-version (from dev can only be used Sortable.js).

@bustikiller
Copy link

Sorry, I forgot to mention that the main branch works fine in a web page, or in a Firefox OS simulator, but when I load the code in my real device, all touches are detected as drag, and no touch is detected as click.

;)

@anandpdoshi
Copy link
Author

Okay. I will test this out on Monday. Thanks for getting back :)

Sent from my phone

On 13-Feb-2015, at 0:44, Lebedev Konstantin [email protected] wrote:

@anandpdoshi Here is an example of work dev-branch, there is no error, the problem maybe due to use min-version (from dev can only be used Sortable.js).


Reply to this email directly or view it on GitHub.

@nevf
Copy link

nevf commented Feb 15, 2015

I'm having the same problem with Bootstrap Tabs where touch on a Tab doesn't select it. This happens on my Samsung Tablet S and in the Chrome Dev Tools with Device Mode set to a Tablet etc. The current download is the same as the Dev branch except for the Version number.

You also get the ghost image on touchstart which doesn't look good if a drag isn't being done. I would think this should only happen (_onDragStart() called) after a touchmove of some minimum specified distance and if touchend occurs without that touchmove, a click is fired.

I've been doing a bit more research and found that some libs like slip https://github.com/pornel/slip don't use HTML5 drag & drop code at all, which maybe worth considering for Sortable. Related articles & code include: http://code.makery.ch/blog/drag-and-drop-without-html5/ https://github.com/rkusa/touch-dnd HTH

@jaesga
Copy link

jaesga commented Mar 5, 2015

Any solution for this problem?

@anandpdoshi
Copy link
Author

Using the sortable dev branch's Sortable.js also doesn't work.

@nevf
Copy link

nevf commented Mar 6, 2015

For anyone interested I've stopped using Sortable.js and am using touch-dnd.js http://ma.rkusa.st/touch-dnd/ It works very nicely on both touch and non-touch devices and doesn't use HTML5 drag & drop. I've helped track down and resolve a few issues and the author has been very responsive.

@kirilgorbachov
Copy link

I found the solution. The problem it's that library use even touchstart, if you change it to touchmove everything will works fine.
_on(el, 'touchmove', this._onTapStart);
_off(el, 'touchmove', this._onTapStart);

@g5724467
Copy link

This bug is fixed by #441 However, it is still a pull request and should be merged.

@MichalRemis
Copy link

For reference, with newer versions click event on touch devices wasn't working again but I had to set fallbackTolerance on SorgableJS to make it work.

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

8 participants