angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

ngClick using ngTouch fires twice

Open coma opened this issue 12 years ago • 67 comments

ngTouch 1.2.1 on Safari iOS 7 fires a second time by tapping wherever on the screen:

http://jsfiddle.net/coma/2hWWa/embedded/result/

http://stackoverflow.com/questions/21708730/why-are-multiple-click-events-fired-when-using-ngtouch/21766071#21766071

coma avatar Feb 13 '14 23:02 coma

I am also having hard times with this issue.

pre avatar Mar 07 '14 09:03 pre

Any ideas what's causing this, and if there's a workaround that I could use?

Arkkimaagi avatar Mar 07 '14 09:03 Arkkimaagi

I think it's something related to the event propagation, this is my workaround:

http://jsfiddle.net/coma/2hWWa

coma avatar Mar 07 '14 09:03 coma

I have a similar problem.

My app has a popup dialog with a button that closes it. When the dialog's button is on top of a text input element, clicking the button on touch screen devices not only closes the dialog, but also focuses the input.

tuomaslahti avatar Mar 07 '14 10:03 tuomaslahti

Same problem here using angular w/ angular-touch 1.2.9.

There is no other clickable elements in the tree to propagate to. The very same click event is fired twice in a row. This does not happen with the swipes. Also, the problem of firing ngClick events twice disappears when I remove ngTouch from the project.

TomiHiltunen avatar Mar 18 '14 12:03 TomiHiltunen

I am also having this problem in ngTouch 1.2.13,

Depending on the situation, this is more than an optical bug, but in my case leads to rather annoying usability problems:

For example I change a View with activated ngTouch and with ng-click on a touch device for to open a modal, which lays it self above the clicked element. Within this modal a clickable element is at the same place as the previously clicked element (now laying above), then it could occur that the second event is fired and the button in modal is clicked/fired.

This could lead to unwanted behaviour of the application.

richardbrammer avatar Mar 19 '14 15:03 richardbrammer

Hi Richard, this is exactly same same kind of problem we are facing.

pre avatar Mar 20 '14 07:03 pre

Reference jquery (before angular.js) to stop the event propagation and prevent the double fires.

ernestoaparicio avatar Sep 04 '14 22:09 ernestoaparicio

That doesn't sound like a fix. We do not use jQuery in our application. Is this string saying that this will not be addressed prior to 1.3?

likesjx avatar Sep 30 '14 13:09 likesjx

This issue is making ngClick unusable. How are people working around this? Debounce? Fallback to original ngClick?

I added ngTouch to get swipe functionality, and now I'm saddled with this issue.

getvictor avatar Oct 30 '14 12:10 getvictor

We've been running our own fork of ng-touch with the changes in https://github.com/angular/angular.js/pull/6995 Other than that, I've seen projects doing manual debouncing where clicks within ~200ms of each other are disregarded.

jayvan avatar Oct 30 '14 13:10 jayvan

I'm running into this issue too. @coma's workaround seems to have fixed it.

jkingsbery avatar Nov 20 '14 18:11 jkingsbery

I believe this same issue is fixed in fastclick already: issue and fix.

visnup avatar Dec 31 '14 21:12 visnup

just started using angular-material and ran into this issue since material includes aria.

louiswilbrink avatar Feb 05 '15 03:02 louiswilbrink

+1 using material as well having the same issue.

cstephe avatar Feb 08 '15 01:02 cstephe

any updates for this issue? and is there a workaround? I am using ngtouch 1.3.14 and still having this issue

bobbajs avatar Mar 03 '15 00:03 bobbajs

+1

eclipse1985 avatar Mar 05 '15 13:03 eclipse1985

Any update on this issue? Developing an app using angular-material and it works great on desktop but on mobile ng-click registers twice.

rahul0705 avatar Mar 08 '15 15:03 rahul0705

In my case jquery (as a dependency of ui-calendar) caused this problem. couldn´t find a fix...

dominikstrasser avatar Mar 08 '15 18:03 dominikstrasser

+1

lreindl avatar Mar 11 '15 16:03 lreindl