-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
cancel native events on hammer event trigger? eg touch #626
Comments
I can confirm that I have the same issue with v2, at least in the native Android browser (tested on 4.1). |
Actually the problem is replicable in ios safari and chrome (try this jsfiddle http://jsfiddle.net/annam/xGJZL/embedded/result/ - tappin on the pink box should not toggle the label below) |
Over here is an interesting solution for this issue... Hopefully i find some time next week to take a look at this. Btw, If i find a robust solution, it will be fixed in v2, or just as a small extra script you can include. |
Hmm that should do the trick.
|
preventing default on touchend, seems to prevent a click event, i've updated the jsfiddle, and it seems to work, (at least in chrome emulating an ipad) But i guess this doesn't really do the trick, since the Google article i posted exists |
I've created this small gist. It's based on the code from the Google article. Haven't tested it, but i guess it works! |
Hi Jorik, thanks for your help. We are looking into the e.gesture.srcEvent.preventDefault() solution. It seems to work on hammer v2, even though the custom e.gesture.preventDefault functions that were integrated in v1 didn't do the trick, and neither did the e.gesture.srcEvent.preventDefault() work on v1 (it seems to target touchmove instead of touchstart). we'll need to upgrade to hammer v2 to use this solution. hopefully we won't come across many conflicts. i'll keep you updated on whether this solves the issue! Thanks again. Cheers, |
Fyi we've also just tested the clickbuster solution, thanks for putting it together! It works for preventing labels below to get toggled, and also prevents "click" events binded on items below to be triggered! (both hammer v1 and v2) However it does not prevent input fields from getting the focus (and popping up the keyboard). We've also had a conflict with the gsap library (greensock.com) where when the tap event propagates, any draggable components below somehow get semi-initialised. clickbuster doesn't solve this either. e.gesture.srcEvent.preventDefault() seems to solve all four of the issues :) I guess depending on the use cases of other users who have the same problem one of the two solutions would be suitable. thanks again for your help! |
Cool! I think preventing focus of input elements shouldnt be done with catching any mouse/touch input, but just by adding the I don't know about the GSAP library, but i guess draggable components make use of the |
Hi Jorik, we do want the input to be focusable. The issue is that if you tap on an element to hide itself and show the input in its place, the input gets focused by the "tap to hide" interaction. |
Any word on getting this integrated into Hammer.js itself? We are in the midst of deciding on various frameworks and at the moment ngTouch is the only one that manages to solve the ghost click problem out of the box. It would be mighty reassuring to hear whether this is planned for Hammer in the near future. :) |
Closing in favor of #808 |
Hello,
I have the following issue: http://stackoverflow.com/questions/24998194/hammer-js-click-triggered-on-dom-elements-behind-tapped-after-tap-action
I hope to prevent it but cancelling native events to prevent them from bubbling/triggering on other elements after they are used on a hammer instance. for example on touchend (which is used on eg tap) touch (and click) events should not be triggered on other elements.
is there a way to do this? perhaps with a custom listener? shouldn't it be the default behaviour anyway? I'm using hammer v1 but I can update if this issue can be solved in v2 but not in v1..
I can find a number of similar issues being reported on both this repository and on stackoverflow
thanks!
The text was updated successfully, but these errors were encountered: