Skip to content
This repository has been archived by the owner on Apr 13, 2022. It is now read-only.

ngClick using ngTouch fires twice #6251

Closed
coma opened this issue Feb 13, 2014 · 67 comments
Closed

ngClick using ngTouch fires twice #6251

coma opened this issue Feb 13, 2014 · 67 comments

Comments

@coma
Copy link

coma commented Feb 13, 2014

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

@pre
Copy link

pre commented Mar 7, 2014

I am also having hard times with this issue.

@Arkkimaagi
Copy link

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

@coma
Copy link
Author

coma commented Mar 7, 2014

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

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

@tuomaslahti
Copy link

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.

@TomiHiltunen
Copy link

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.

@richardbrammer
Copy link

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.

@pre
Copy link

pre commented Mar 20, 2014

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

jayvan pushed a commit to jayvan/angular.js that referenced this issue Apr 4, 2014
ngClick was leaking ghost click events when the touch Startmoved a small
distance. This is because if there was a touchMove event between the
touchStart and touchEnd preventGhostClick would not be called. This also
caused the MOVE_TOLERANCE threshold to be ignored because any change in
position would stop preventGhostClick from being run.

Cancelling a tap is now correctly based on the MOVE_TOLERANCE, and ghost
clicks are not leaked.

Closes angular#6251
jayvan pushed a commit to jayvan/angular.js that referenced this issue Apr 4, 2014
ngClick was leaking ghost click events when the touch Startmoved a small
distance. This is because if there was a touchMove event between the
touchStart and touchEnd preventGhostClick would not be called. This also
caused the MOVE_TOLERANCE threshold to be ignored because any change in
position would stop preventGhostClick from being run.

Cancelling a tap is now correctly based on the MOVE_TOLERANCE, and ghost
clicks are not leaked.

Closes angular#6251
@jeffbcross jeffbcross added this to the 1.3.0 milestone Apr 7, 2014
@jeffbcross jeffbcross self-assigned this Apr 7, 2014
@jeffbcross jeffbcross removed their assignment Apr 7, 2014
@btford btford removed the gh: issue label Aug 20, 2014
@ernestoaparicio
Copy link

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

@likesjx
Copy link

likesjx commented Sep 30, 2014

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?

@getvictor
Copy link

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.

@jayvan
Copy link

jayvan commented Oct 30, 2014

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

@jkingsbery
Copy link

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

@visnup
Copy link

visnup commented Dec 31, 2014

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

@louiswilbrink
Copy link

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

@cstephe
Copy link

cstephe commented Feb 8, 2015

+1 using material as well having the same issue.

@msimr
Copy link

msimr commented Nov 17, 2015

Hum, fastclick creates other issues.
As an example, ng-places-autocomplete stops working properly as soon as fastclick.js is added to the project.

@petebacondarwin
Copy link
Member

I wonder if that is a bug that could be fixed in ng-places-autocomplete?

@msimr
Copy link

msimr commented Nov 17, 2015

No doubt it can be fixed in ng-places-autocomplete.
But, if we find one issue there, we'll probably find the same thing in other ui libs.

@michaelyuen
Copy link

Just encountered this issue. Can confirm it is with ngTouch, as removing it caused the issue to disappear.

In my case, ng-click would eventually cause partials to be hidden and shown, with the input on the new partial that is in the same location as the ng-click triggering the keyboard.

Tried @NorikDavtian 's suggested fix as well as the code here (#11342) to no avail.

In my case, the fix came by adding $event.preventDefault() to the ng-click on the button where the event was originating.

@jirehstudios
Copy link

Same issue, but fixed with the solution provided by @michaelyuen

<a data-ng-click="goTo($event, 'route/path')">Link</a>

$scope.goTo = function ($event, route) {
    $event.preventDefault();
    $location.url(route);
};

@nathanredblur
Copy link

This bug was happening to me too. I try update ng-touch to 1.4.8, the last workaround but not works.
This was happen in a small dropdown window I fixed whit this.

scope.domFn = function($event, value) {
  // hack to fix bug with angular ngTouch
  if($event.type == "touchend") {return}
  someAwsomeStuff(value);
};

I hope this help someone.

Narretz added a commit to Narretz/angular.js that referenced this issue Jan 26, 2016
This commit removes the ngClick directive from the ngTouch module.
The directive was conceived to remove the 300ms delay
for click events on mobile browsers, by sending a synthetic click event on touchstart.
It also tried to make sure that the original click event that the browser sends after 300ms
was "busted", so that no redundant "ghost-clicks" appear.

There are various reasons why this feature has been removed:

- "This is an ugly, terrible hack!" (says so in the source)
- It is plagued by various bugs that are hard to fix / test for all platforms (see below)
- Simply including ngTouch activates the ngClick override, which means even if you simply want
to use ngSwipe, you may break parts of your app
- There exist alternatives for removing the 300ms delay, that can be used very well with Angular:
[FastClick](https://github.com/ftlabs/fastclick), [Tappy!](https://github.com/filamentgroup/tappy/)
(There's also hammer.js for touch events / gestures)
- The 300ms delay itself is on the way out - Chrome and Firefox for Android remove the 300ms delay
when the usual `<meta name="viewport" content="width=device-width">` is set. In IE, the
`touch-action` css property can be set to `none` or `manipulation` to remove the delay. Finally,
since iOs 8, Safari doesn't delay "slow" taps anymore. There are some caveats though, which can be
found in this excellent article on which this summary is based: http://developer.telerik.com/featured/300-ms-click-delay-ios-8/

Note that this change does not affect the `ngSwipe` directive.

Issues with interactive elements (input, a etc.) when parent element has ngClick:
Closes angular#13287
Closes angular#13558
Closes angular#12392
Closes angular#12153
Closes angular#11358
Closes angular#6432
Closes angular#12867
Closes angular#7231
Closes angular#13213
Closes angular#12082
Closes angular#4030
Closes angular#12545
Closes angular#6001
Closes angular#5307

Other issues:
- incorrect event order
- incorrect event propagation
- ghost-clicks / failing clickbusting with corner cases
- browser specific bugs
- et al.
Closes angular#12734
Closes angular#12455
Closes angular#11197
Closes angular#11261
Closes angular#12150
Closes angular#10918
Closes angular#10366
Closes angular#9872
Closes angular#9744
Closes angular#6251
Closes angular#4428
Closes angular#3999
Closes angular#3347
Closes angular#3296
Closes angular#7935
Closes angular#13272
Closes angular#13447
Closes angular#13122
Closes angular#12317
Closes angular#11577
Closes angular#11342
Closes angular#10211
Closes angular#9724
Closes angular#7134
Closes angular#6330
Closes angular#3447

BREAKING CHANGE:

The `ngClick` override from the `ngTouch` module has been removed. This means that on
touch-based devices, users might experience a 300ms delay before an ngClick event is fired.

If you rely on this behavior, consider using [FastClick](https://github.com/ftlabs/fastclick) or
[Tappy!](https://github.com/filamentgroup/tappy/). Also note that modern browsers remove the 300ms
delay under some circumstances:
- Chrome and Firefox for Android remove the 300ms delay when the well-known `<meta name="viewport" content="width=device-width">` is set
- Internet Explorer removes the delay when  `touch-action` css property is set to `none` or `manipulation`
- Since iOs 8, Safari removes the delay on so-called "slow taps"
See this article for more info on the topic: http://developer.telerik.com/featured/300-ms-click-delay-ios-8/
Narretz added a commit to Narretz/angular.js that referenced this issue Jan 26, 2016
This commit removes the ngClick directive from the ngTouch module.
The directive was conceived to remove the 300ms delay
for click events on mobile browsers, by sending a synthetic click event on touchstart.
It also tried to make sure that the original click event that the browser sends after 300ms
was "busted", so that no redundant "ghost-clicks" appear.

There are various reasons why this feature has been removed:

- "This is an ugly, terrible hack!" (says so in the source)
- It is plagued by various bugs that are hard to fix / test for all platforms (see below)
- Simply including ngTouch activates the ngClick override, which means even if you simply want
to use ngSwipe, you may break parts of your app
- There exist alternatives for removing the 300ms delay, that can be used very well with Angular:
[FastClick](https://github.com/ftlabs/fastclick), [Tappy!](https://github.com/filamentgroup/tappy/)
(There's also hammer.js for touch events / gestures)
- The 300ms delay itself is on the way out - Chrome and Firefox for Android remove the 300ms delay
when the usual `<meta name="viewport" content="width=device-width">` is set. In IE, the
`touch-action` css property can be set to `none` or `manipulation` to remove the delay. Finally,
since iOs 8, Safari doesn't delay "slow" taps anymore. There are some caveats though, which can be
found in this excellent article on which this summary is based: http://developer.telerik.com/featured/300-ms-click-delay-ios-8/

Note that this change does not affect the `ngSwipe` directive.

Issues with interactive elements (input, a etc.) when parent element has ngClick:
Closes angular#13287
Closes angular#13558
Closes angular#12392
Closes angular#12153
Closes angular#11358
Closes angular#6432
Closes angular#12867
Closes angular#7231
Closes angular#13213
Closes angular#12082
Closes angular#4030
Closes angular#12545
Closes angular#6001
Closes angular#5307

Other issues:
- incorrect event order
- incorrect event propagation
- ghost-clicks / failing clickbusting with corner cases
- browser specific bugs
- et al.
Closes angular#12734
Closes angular#12455
Closes angular#11197
Closes angular#11261
Closes angular#12150
Closes angular#10918
Closes angular#10366
Closes angular#9872
Closes angular#9744
Closes angular#6251
Closes angular#4428
Closes angular#3999
Closes angular#3347
Closes angular#3296
Closes angular#7935
Closes angular#13272
Closes angular#13447
Closes angular#13122
Closes angular#12317
Closes angular#11577
Closes angular#11342
Closes angular#10211
Closes angular#9724
Closes angular#7134
Closes angular#6330
Closes angular#3447

BREAKING CHANGE:

The `ngClick` override from the `ngTouch` module has been removed. This means that on
touch-based devices, users might experience a 300ms delay before an ngClick event is fired.

If you rely on this behavior, consider using [FastClick](https://github.com/ftlabs/fastclick) or
[Tappy!](https://github.com/filamentgroup/tappy/). Also note that modern browsers remove the 300ms
delay under some circumstances:
- Chrome and Firefox for Android remove the 300ms delay when the well-known `<meta name="viewport" content="width=device-width">` is set
- Internet Explorer removes the delay when  `touch-action` css property is set to `none` or `manipulation`
- Since iOs 8, Safari removes the delay on so-called "slow taps"
See this article for more info on the topic: http://developer.telerik.com/featured/300-ms-click-delay-ios-8/
Narretz added a commit to Narretz/angular.js that referenced this issue Jan 26, 2016
This commit removes the ngClick directive from the ngTouch module.
The directive was conceived to remove the 300ms delay
for click events on mobile browsers, by sending a synthetic click event on touchstart.
It also tried to make sure that the original click event that the browser sends after 300ms
was "busted", so that no redundant "ghost-clicks" appear.

There are various reasons why this feature has been removed:

- "This is an ugly, terrible hack!" (says so in the source)
- It is plagued by various bugs that are hard to fix / test for all platforms (see below)
- Simply including ngTouch activates the ngClick override, which means even if you simply want
to use ngSwipe, you may break parts of your app
- There exist alternatives for removing the 300ms delay, that can be used very well with Angular:
[FastClick](https://github.com/ftlabs/fastclick), [Tappy!](https://github.com/filamentgroup/tappy/)
(There's also hammer.js for touch events / gestures)
- The 300ms delay itself is on the way out - Chrome and Firefox for Android remove the 300ms delay
when the usual `<meta name="viewport" content="width=device-width">` is set. In IE, the
`touch-action` css property can be set to `none` or `manipulation` to remove the delay. Finally,
since iOs 8, Safari doesn't delay "slow" taps anymore. There are some caveats though, which can be
found in this excellent article on which this summary is based: http://developer.telerik.com/featured/300-ms-click-delay-ios-8/

Note that this change does not affect the `ngSwipe` directive.

Issues with interactive elements (input, a etc.) when parent element has ngClick:
Closes angular#4030
Closes angular#5307
Closes angular#6001
Closes angular#6432
Closes angular#7231
Closes angular#11358
Closes angular#12082
Closes angular#12153
Closes angular#12392
Closes angular#12545
Closes angular#12867
Closes angular#13213
Closes angular#13558

Other issues:
- incorrect event order
- incorrect event propagation
- ghost-clicks / failing clickbusting with corner cases
- browser specific bugs
- et al.

Closes angular#3296
Closes angular#3347
Closes angular#3447
Closes angular#3999
Closes angular#4428
Closes angular#6251
Closes angular#6330
Closes angular#7134
Closes angular#7935
Closes angular#9724
Closes angular#9744
Closes angular#9872
Closes angular#10211
Closes angular#10366
Closes angular#10918
Closes angular#11197
Closes angular#11261
Closes angular#11342
Closes angular#11577
Closes angular#12150
Closes angular#12317
Closes angular#12455
Closes angular#12734
Closes angular#13122
Closes angular#13272
Closes angular#13447

BREAKING CHANGE:

The `ngClick` override directive from the `ngTouch` module has been removed. This means that on
touch-based devices, users might now experience a 300ms delay before a click event is fired.

If you rely on this behavior, consider using [FastClick](https://github.com/ftlabs/fastclick) or
[Tappy!](https://github.com/filamentgroup/tappy/). Also note that modern browsers remove the 300ms
delay under some circumstances:
- Chrome and Firefox for Android remove the 300ms delay when the well-known `<meta name="viewport" content="width=device-width">` is set
- Internet Explorer removes the delay when  `touch-action` css property is set to `none` or `manipulation`
- Since iOs 8, Safari removes the delay on so-called "slow taps"
See this article for more info on the topic: http://developer.telerik.com/featured/300-ms-click-delay-ios-8/
Narretz added a commit to Narretz/angular.js that referenced this issue Jan 27, 2016
…ault

This commit deprecates the ngClick directive from the ngTouch module.
Additionally, it disables it by default. It can be enabled in the new $touchProvider with
$touchProvider.ngClickOverrideEnabled() method.

The directive was conceived to remove the 300ms delay
for click events on mobile browsers, by sending a synthetic click event on touchstart.
It also tried to make sure that the original click event that the browser sends after 300ms
was "busted", so that no redundant "ghost-clicks" appear.

There are various reasons why the directive is being deprecated.

- "This is an ugly, terrible hack!" (says so in the source)
- It is plagued by various bugs that are hard to fix / test for all platforms (see below)
- Simply including ngTouch activates the ngClick override, which means even if you simply want
to use ngSwipe, you may break parts of your app
- There exist alternatives for removing the 300ms delay, that can be used very well with Angular:
[FastClick](https://github.com/ftlabs/fastclick), [Tappy!](https://github.com/filamentgroup/tappy/)
(There's also hammer.js for touch events / gestures)
- The 300ms delay itself is on the way out - Chrome and Firefox for Android remove the 300ms delay
when the usual `<meta name="viewport" content="width=device-width">` is set. In IE, the
`touch-action` css property can be set to `none` or `manipulation` to remove the delay. Finally,
since iOs 8, Safari doesn't delay "slow" taps anymore. There are some caveats though, which can be
found in this excellent article on which this summary is based: http://developer.telerik.com/featured/300-ms-click-delay-ios-8/

Note that this change does not affect the `ngSwipe` directive.

Issues with interactive elements (input, a etc.) when parent element has ngClick:
Closes angular#4030
Closes angular#5307
Closes angular#6001
Closes angular#6432
Closes angular#7231
Closes angular#11358
Closes angular#12082
Closes angular#12153
Closes angular#12392
Closes angular#12545
Closes angular#12867
Closes angular#13213
Closes angular#13558

Other issues:
- incorrect event order
- incorrect event propagation
- ghost-clicks / failing clickbusting with corner cases
- browser specific bugs
- et al.

Closes angular#3296
Closes angular#3347
Closes angular#3447
Closes angular#3999
Closes angular#4428
Closes angular#6251
Closes angular#6330
Closes angular#7134
Closes angular#7935
Closes angular#9724
Closes angular#9744
Closes angular#9872
Closes angular#10211
Closes angular#10366
Closes angular#10918
Closes angular#11197
Closes angular#11261
Closes angular#11342
Closes angular#11577
Closes angular#12150
Closes angular#12317
Closes angular#12455
Closes angular#12734
Closes angular#13122
Closes angular#13272
Closes angular#13447

BREAKING CHANGE:

The `ngClick` override directive from the `ngTouch` module is **deprecated and disabled by default**.
This means that on touch-based devices, users might now experience a 300ms delay before a click event is fired.

If you rely on this directive, you can still enable it with the `$touchProvider.ngClickOverrideEnabled()`method:

```js
angular.module('myApp').config(function($touchProvider) {
  $touchProvider.ngClickOverrideEnabled(true);
});
```

For migration, we recommend using [FastClick](https://github.com/ftlabs/fastclick).
Also note that modern browsers remove the 300ms delay under some circumstances:
- Chrome and Firefox for Android remove the 300ms delay when the well-known `<meta name="viewport" content="width=device-width">` is set
- Internet Explorer removes the delay when  `touch-action` css property is set to `none` or `manipulation`
- Since iOs 8, Safari removes the delay on so-called "slow taps"

See this [article by Telerik](http://developer.telerik.com/featured/300-ms-click-delay-ios-8/) for more info on the topic.
Note that this change does not affect the `ngSwipe` directive.
Narretz added a commit to Narretz/angular.js that referenced this issue Jan 27, 2016
…ault

This commit deprecates the ngClick directive from the ngTouch module.
Additionally, it disables it by default. It can be enabled in the new $touchProvider with
$touchProvider.ngClickOverrideEnabled() method.

The directive was conceived to remove the 300ms delay
for click events on mobile browsers, by sending a synthetic click event on touchstart.
It also tried to make sure that the original click event that the browser sends after 300ms
was "busted", so that no redundant "ghost-clicks" appear.

There are various reasons why the directive is being deprecated.

- "This is an ugly, terrible hack!" (says so in the source)
- It is plagued by various bugs that are hard to fix / test for all platforms (see below)
- Simply including ngTouch activates the ngClick override, which means even if you simply want
to use ngSwipe, you may break parts of your app
- There exist alternatives for removing the 300ms delay, that can be used very well with Angular:
[FastClick](https://github.com/ftlabs/fastclick), [Tappy!](https://github.com/filamentgroup/tappy/)
(There's also hammer.js for touch events / gestures)
- The 300ms delay itself is on the way out - Chrome and Firefox for Android remove the 300ms delay
when the usual `<meta name="viewport" content="width=device-width">` is set. In IE, the
`touch-action` css property can be set to `none` or `manipulation` to remove the delay. Finally,
since iOs 8, Safari doesn't delay "slow" taps anymore. There are some caveats though, which can be
found in this excellent article on which this summary is based: http://developer.telerik.com/featured/300-ms-click-delay-ios-8/

Note that this change does not affect the `ngSwipe` directive.

Issues with interactive elements (input, a etc.) when parent element has ngClick:
Closes angular#4030
Closes angular#5307
Closes angular#6001
Closes angular#6432
Closes angular#7231
Closes angular#11358
Closes angular#12082
Closes angular#12153
Closes angular#12392
Closes angular#12545
Closes angular#12867
Closes angular#13213
Closes angular#13558

Other issues:
- incorrect event order
- incorrect event propagation
- ghost-clicks / failing clickbusting with corner cases
- browser specific bugs
- et al.

Closes angular#3296
Closes angular#3347
Closes angular#3447
Closes angular#3999
Closes angular#4428
Closes angular#6251
Closes angular#6330
Closes angular#7134
Closes angular#7935
Closes angular#9724
Closes angular#9744
Closes angular#9872
Closes angular#10211
Closes angular#10366
Closes angular#10918
Closes angular#11197
Closes angular#11261
Closes angular#11342
Closes angular#11577
Closes angular#12150
Closes angular#12317
Closes angular#12455
Closes angular#12734
Closes angular#13122
Closes angular#13272
Closes angular#13447

BREAKING CHANGE:

The `ngClick` override directive from the `ngTouch` module is **deprecated and disabled by default**.
This means that on touch-based devices, users might now experience a 300ms delay before a click event is fired.

If you rely on this directive, you can still enable it with the `$touchProvider.ngClickOverrideEnabled()`method:

```js
angular.module('myApp').config(function($touchProvider) {
  $touchProvider.ngClickOverrideEnabled(true);
});
```

For migration, we recommend using [FastClick](https://github.com/ftlabs/fastclick).
Also note that modern browsers remove the 300ms delay under some circumstances:
- Chrome and Firefox for Android remove the 300ms delay when the well-known `<meta name="viewport" content="width=device-width">` is set
- Internet Explorer removes the delay when  `touch-action` css property is set to `none` or `manipulation`
- Since iOs 8, Safari removes the delay on so-called "slow taps"

See this [article by Telerik](http://developer.telerik.com/featured/300-ms-click-delay-ios-8/) for more info on the topic.
Note that this change does not affect the `ngSwipe` directive.
Narretz added a commit to Narretz/angular.js that referenced this issue Jan 27, 2016
…ault

This commit deprecates the ngClick directive from the ngTouch module.
Additionally, it disables it by default. It can be enabled in the new $touchProvider with
$touchProvider.ngClickOverrideEnabled() method.

The directive was conceived to remove the 300ms delay
for click events on mobile browsers, by sending a synthetic click event on touchstart.
It also tried to make sure that the original click event that the browser sends after 300ms
was "busted", so that no redundant "ghost-clicks" appear.

There are various reasons why the directive is being deprecated.

- "This is an ugly, terrible hack!" (says so in the source)
- It is plagued by various bugs that are hard to fix / test for all platforms (see below)
- Simply including ngTouch activates the ngClick override, which means even if you simply want
to use ngSwipe, you may break parts of your app
- There exist alternatives for removing the 300ms delay, that can be used very well with Angular:
[FastClick](https://github.com/ftlabs/fastclick), [Tappy!](https://github.com/filamentgroup/tappy/)
(There's also hammer.js for touch events / gestures)
- The 300ms delay itself is on the way out - Chrome and Firefox for Android remove the 300ms delay
when the usual `<meta name="viewport" content="width=device-width">` is set. In IE, the
`touch-action` css property can be set to `none` or `manipulation` to remove the delay. Finally,
since iOs 8, Safari doesn't delay "slow" taps anymore. There are some caveats though, which can be
found in this excellent article on which this summary is based: http://developer.telerik.com/featured/300-ms-click-delay-ios-8/

Note that this change does not affect the `ngSwipe` directive.

Issues with interactive elements (input, a etc.) when parent element has ngClick:
Closes angular#4030
Closes angular#5307
Closes angular#6001
Closes angular#6432
Closes angular#7231
Closes angular#11358
Closes angular#12082
Closes angular#12153
Closes angular#12392
Closes angular#12545
Closes angular#12867
Closes angular#13213
Closes angular#13558

Other issues:
- incorrect event order
- incorrect event propagation
- ghost-clicks / failing clickbusting with corner cases
- browser specific bugs
- et al.

Closes angular#3296
Closes angular#3347
Closes angular#3447
Closes angular#3999
Closes angular#4428
Closes angular#6251
Closes angular#6330
Closes angular#7134
Closes angular#7935
Closes angular#9724
Closes angular#9744
Closes angular#9872
Closes angular#10211
Closes angular#10366
Closes angular#10918
Closes angular#11197
Closes angular#11261
Closes angular#11342
Closes angular#11577
Closes angular#12150
Closes angular#12317
Closes angular#12455
Closes angular#12734
Closes angular#13122
Closes angular#13272
Closes angular#13447

BREAKING CHANGE:

The `ngClick` override directive from the `ngTouch` module is **deprecated and disabled by default**.
This means that on touch-based devices, users might now experience a 300ms delay before a click event is fired.

If you rely on this directive, you can still enable it with the `$touchProvider.ngClickOverrideEnabled()`method:

```js
angular.module('myApp').config(function($touchProvider) {
  $touchProvider.ngClickOverrideEnabled(true);
});
```

For migration, we recommend using [FastClick](https://github.com/ftlabs/fastclick).
Also note that modern browsers remove the 300ms delay under some circumstances:
- Chrome and Firefox for Android remove the 300ms delay when the well-known `<meta name="viewport" content="width=device-width">` is set
- Internet Explorer removes the delay when  `touch-action` css property is set to `none` or `manipulation`
- Since iOs 8, Safari removes the delay on so-called "slow taps"

See this [article by Telerik](http://developer.telerik.com/featured/300-ms-click-delay-ios-8/) for more info on the topic.
Note that this change does not affect the `ngSwipe` directive.
Narretz added a commit to Narretz/angular.js that referenced this issue Jan 27, 2016
…ault

This commit deprecates the ngClick directive from the ngTouch module.
Additionally, it disables it by default. It can be enabled in the new $touchProvider with
$touchProvider.ngClickOverrideEnabled() method.

The directive was conceived to remove the 300ms delay
for click events on mobile browsers, by sending a synthetic click event on touchstart.
It also tried to make sure that the original click event that the browser sends after 300ms
was "busted", so that no redundant "ghost-clicks" appear.

There are various reasons why the directive is being deprecated.

- "This is an ugly, terrible hack!" (says so in the source)
- It is plagued by various bugs that are hard to fix / test for all platforms (see below)
- Simply including ngTouch activates the ngClick override, which means even if you simply want
to use ngSwipe, you may break parts of your app
- There exist alternatives for removing the 300ms delay, that can be used very well with Angular:
[FastClick](https://github.com/ftlabs/fastclick), [Tappy!](https://github.com/filamentgroup/tappy/)
(There's also hammer.js for touch events / gestures)
- The 300ms delay itself is on the way out - Chrome and Firefox for Android remove the 300ms delay
when the usual `<meta name="viewport" content="width=device-width">` is set. In IE, the
`touch-action` css property can be set to `none` or `manipulation` to remove the delay. Finally,
since iOs 8, Safari doesn't delay "slow" taps anymore. There are some caveats though, which can be
found in this excellent article on which this summary is based: http://developer.telerik.com/featured/300-ms-click-delay-ios-8/

Note that this change does not affect the `ngSwipe` directive.

Issues with interactive elements (input, a etc.) when parent element has ngClick:
Closes angular#4030
Closes angular#5307
Closes angular#6001
Closes angular#6432
Closes angular#7231
Closes angular#11358
Closes angular#12082
Closes angular#12153
Closes angular#12392
Closes angular#12545
Closes angular#12867
Closes angular#13213
Closes angular#13558

Other issues:
- incorrect event order
- incorrect event propagation
- ghost-clicks / failing clickbusting with corner cases
- browser specific bugs
- et al.

Closes angular#3296
Closes angular#3347
Closes angular#3447
Closes angular#3999
Closes angular#4428
Closes angular#6251
Closes angular#6330
Closes angular#7134
Closes angular#7935
Closes angular#9724
Closes angular#9744
Closes angular#9872
Closes angular#10211
Closes angular#10366
Closes angular#10918
Closes angular#11197
Closes angular#11261
Closes angular#11342
Closes angular#11577
Closes angular#12150
Closes angular#12317
Closes angular#12455
Closes angular#12734
Closes angular#13122
Closes angular#13272
Closes angular#13447

BREAKING CHANGE:

The `ngClick` override directive from the `ngTouch` module is **deprecated and disabled by default**.
This means that on touch-based devices, users might now experience a 300ms delay before a click event is fired.

If you rely on this directive, you can still enable it with the `$touchProvider.ngClickOverrideEnabled()`method:

```js
angular.module('myApp').config(function($touchProvider) {
  $touchProvider.ngClickOverrideEnabled(true);
});
```

For migration, we recommend using [FastClick](https://github.com/ftlabs/fastclick).
Also note that modern browsers remove the 300ms delay under some circumstances:
- Chrome and Firefox for Android remove the 300ms delay when the well-known `<meta name="viewport" content="width=device-width">` is set
- Internet Explorer removes the delay when  `touch-action` css property is set to `none` or `manipulation`
- Since iOs 8, Safari removes the delay on so-called "slow taps"

See this [article by Telerik](http://developer.telerik.com/featured/300-ms-click-delay-ios-8/) for more info on the topic.
Note that this change does not affect the `ngSwipe` directive.
Narretz added a commit to Narretz/angular.js that referenced this issue Jan 27, 2016
This commit deprecates the ngClick directive from the ngTouch module.
Additionally, it disables it by default. It can be enabled in the new $touchProvider with
$touchProvider.ngClickOverrideEnabled() method.

The directive was conceived to remove the 300ms delay
for click events on mobile browsers, by sending a synthetic click event on touchstart.
It also tried to make sure that the original click event that the browser sends after 300ms
was "busted", so that no redundant "ghost-clicks" appear.

There are various reasons why the directive is being deprecated.

- "This is an ugly, terrible hack!" (says so in the source)
- It is plagued by various bugs that are hard to fix / test for all platforms (see below)
- Simply including ngTouch activates the ngClick override, which means even if you simply want
to use ngSwipe, you may break parts of your app
- There exist alternatives for removing the 300ms delay, that can be used very well with Angular:
[FastClick](https://github.com/ftlabs/fastclick), [Tappy!](https://github.com/filamentgroup/tappy/)
(There's also hammer.js for touch events / gestures)
- The 300ms delay itself is on the way out - Chrome and Firefox for Android remove the 300ms delay
when the usual `<meta name="viewport" content="width=device-width">` is set. In IE, the
`touch-action` css property can be set to `none` or `manipulation` to remove the delay. Finally,
since iOs 8, Safari doesn't delay "slow" taps anymore. There are some caveats though, which can be
found in this excellent article on which this summary is based: http://developer.telerik.com/featured/300-ms-click-delay-ios-8/

Note that this change does not affect the `ngSwipe` directive.

Issues with interactive elements (input, a etc.) when parent element has ngClick:
Closes angular#4030
Closes angular#5307
Closes angular#6001
Closes angular#6432
Closes angular#7231
Closes angular#11358
Closes angular#12082
Closes angular#12153
Closes angular#12392
Closes angular#12545
Closes angular#12867
Closes angular#13213
Closes angular#13558

Other issues:
- incorrect event order
- incorrect event propagation
- ghost-clicks / failing clickbusting with corner cases
- browser specific bugs
- et al.

Closes angular#3296
Closes angular#3347
Closes angular#3447
Closes angular#3999
Closes angular#4428
Closes angular#6251
Closes angular#6330
Closes angular#7134
Closes angular#7935
Closes angular#9724
Closes angular#9744
Closes angular#9872
Closes angular#10211
Closes angular#10366
Closes angular#10918
Closes angular#11197
Closes angular#11261
Closes angular#11342
Closes angular#11577
Closes angular#12150
Closes angular#12317
Closes angular#12455
Closes angular#12734
Closes angular#13122
Closes angular#13272
Closes angular#13447

BREAKING CHANGE:

The `ngClick` override directive from the `ngTouch` module is **deprecated and disabled by default**.
This means that on touch-based devices, users might now experience a 300ms delay before a click event is fired.

If you rely on this directive, you can still enable it with the `$touchProvider.ngClickOverrideEnabled()`method:

```js
angular.module('myApp').config(function($touchProvider) {
  $touchProvider.ngClickOverrideEnabled(true);
});
```

For migration, we recommend using [FastClick](https://github.com/ftlabs/fastclick).
Also note that modern browsers remove the 300ms delay under some circumstances:
- Chrome and Firefox for Android remove the 300ms delay when the well-known `<meta name="viewport" content="width=device-width">` is set
- Internet Explorer removes the delay when  `touch-action` css property is set to `none` or `manipulation`
- Since iOs 8, Safari removes the delay on so-called "slow taps"

See this [article by Telerik](http://developer.telerik.com/featured/300-ms-click-delay-ios-8/) for more info on the topic.
Note that this change does not affect the `ngSwipe` directive.
Narretz added a commit to Narretz/angular.js that referenced this issue Jan 27, 2016
This commit deprecates the ngClick directive from the ngTouch module.
Additionally, it disables it by default. It can be enabled in the new $touchProvider with
$touchProvider.ngClickOverrideEnabled() method.

The directive was conceived to remove the 300ms delay
for click events on mobile browsers, by sending a synthetic click event on touchstart.
It also tried to make sure that the original click event that the browser sends after 300ms
was "busted", so that no redundant "ghost-clicks" appear.

There are various reasons why the directive is being deprecated.

- "This is an ugly, terrible hack!" (says so in the source)
- It is plagued by various bugs that are hard to fix / test for all platforms (see below)
- Simply including ngTouch activates the ngClick override, which means even if you simply want
to use ngSwipe, you may break parts of your app
- There exist alternatives for removing the 300ms delay, that can be used very well with Angular:
[FastClick](https://github.com/ftlabs/fastclick), [Tappy!](https://github.com/filamentgroup/tappy/)
(There's also hammer.js for touch events / gestures)
- The 300ms delay itself is on the way out - Chrome and Firefox for Android remove the 300ms delay
when the usual `<meta name="viewport" content="width=device-width">` is set. In IE, the
`touch-action` css property can be set to `none` or `manipulation` to remove the delay. Finally,
since iOs 8, Safari doesn't delay "slow" taps anymore. There are some caveats though, which can be
found in this excellent article on which this summary is based: http://developer.telerik.com/featured/300-ms-click-delay-ios-8/

Note that this change does not affect the `ngSwipe` directive.

Issues with interactive elements (input, a etc.) when parent element has ngClick:
Closes angular#4030
Closes angular#5307
Closes angular#6001
Closes angular#6432
Closes angular#7231
Closes angular#11358
Closes angular#12082
Closes angular#12153
Closes angular#12392
Closes angular#12545
Closes angular#12867
Closes angular#13213
Closes angular#13558

Other issues:
- incorrect event order
- incorrect event propagation
- ghost-clicks / failing clickbusting with corner cases
- browser specific bugs
- et al.

Closes angular#3296
Closes angular#3347
Closes angular#3447
Closes angular#3999
Closes angular#4428
Closes angular#6251
Closes angular#6330
Closes angular#7134
Closes angular#7935
Closes angular#9724
Closes angular#9744
Closes angular#9872
Closes angular#10211
Closes angular#10366
Closes angular#10918
Closes angular#11197
Closes angular#11261
Closes angular#11342
Closes angular#11577
Closes angular#12150
Closes angular#12317
Closes angular#12455
Closes angular#12734
Closes angular#13122
Closes angular#13272
Closes angular#13447

BREAKING CHANGE:

The `ngClick` override directive from the `ngTouch` module is **deprecated and disabled by default**.
This means that on touch-based devices, users might now experience a 300ms delay before a click event is fired.

If you rely on this directive, you can still enable it with the `$touchProvider.ngClickOverrideEnabled()`method:

```js
angular.module('myApp').config(function($touchProvider) {
  $touchProvider.ngClickOverrideEnabled(true);
});
```

For migration, we recommend using [FastClick](https://github.com/ftlabs/fastclick).
Also note that modern browsers remove the 300ms delay under some circumstances:
- Chrome and Firefox for Android remove the 300ms delay when the well-known `<meta name="viewport" content="width=device-width">` is set
- Internet Explorer removes the delay when  `touch-action` css property is set to `none` or `manipulation`
- Since iOs 8, Safari removes the delay on so-called "slow taps"

See this [article by Telerik](http://developer.telerik.com/featured/300-ms-click-delay-ios-8/) for more info on the topic.
Note that this change does not affect the `ngSwipe` directive.
Narretz added a commit to Narretz/angular.js that referenced this issue Jan 27, 2016
This commit deprecates the ngClick directive from the ngTouch module.
Additionally, it disables it by default. It can be enabled in the new $touchProvider with
$touchProvider.ngClickOverrideEnabled() method.

The directive was conceived to remove the 300ms delay
for click events on mobile browsers, by sending a synthetic click event on touchstart.
It also tried to make sure that the original click event that the browser sends after 300ms
was "busted", so that no redundant "ghost-clicks" appear.

There are various reasons why the directive is being deprecated.

- "This is an ugly, terrible hack!" (says so in the source)
- It is plagued by various bugs that are hard to fix / test for all platforms (see below)
- Simply including ngTouch activates the ngClick override, which means even if you simply want
to use ngSwipe, you may break parts of your app
- There exist alternatives for removing the 300ms delay, that can be used very well with Angular:
[FastClick](https://github.com/ftlabs/fastclick), [Tappy!](https://github.com/filamentgroup/tappy/)
(There's also hammer.js for touch events / gestures)
- The 300ms delay itself is on the way out - Chrome and Firefox for Android remove the 300ms delay
when the usual `<meta name="viewport" content="width=device-width">` is set. In IE, the
`touch-action` css property can be set to `none` or `manipulation` to remove the delay. Finally,
since iOs 8, Safari doesn't delay "slow" taps anymore. There are some caveats though, which can be
found in this excellent article on which this summary is based: http://developer.telerik.com/featured/300-ms-click-delay-ios-8/

Note that this change does not affect the `ngSwipe` directive.

Issues with interactive elements (input, a etc.) when parent element has ngClick:
Closes angular#4030
Closes angular#5307
Closes angular#6001
Closes angular#6432
Closes angular#7231
Closes angular#11358
Closes angular#12082
Closes angular#12153
Closes angular#12392
Closes angular#12545
Closes angular#12867
Closes angular#13213
Closes angular#13558

Other issues:
- incorrect event order
- incorrect event propagation
- ghost-clicks / failing clickbusting with corner cases
- browser specific bugs
- et al.

Closes angular#3296
Closes angular#3347
Closes angular#3447
Closes angular#3999
Closes angular#4428
Closes angular#6251
Closes angular#6330
Closes angular#7134
Closes angular#7935
Closes angular#9724
Closes angular#9744
Closes angular#9872
Closes angular#10211
Closes angular#10366
Closes angular#10918
Closes angular#11197
Closes angular#11261
Closes angular#11342
Closes angular#11577
Closes angular#12150
Closes angular#12317
Closes angular#12455
Closes angular#12734
Closes angular#13122
Closes angular#13272
Closes angular#13447

BREAKING CHANGE:

The `ngClick` override directive from the `ngTouch` module is **deprecated and disabled by default**.
This means that on touch-based devices, users might now experience a 300ms delay before a click event is fired.

If you rely on this directive, you can still enable it with the `$touchProvider.ngClickOverrideEnabled()`method:

```js
angular.module('myApp').config(function($touchProvider) {
  $touchProvider.ngClickOverrideEnabled(true);
});
```

For migration, we recommend using [FastClick](https://github.com/ftlabs/fastclick).
Also note that modern browsers remove the 300ms delay under some circumstances:
- Chrome and Firefox for Android remove the 300ms delay when the well-known `<meta name="viewport" content="width=device-width">` is set
- Internet Explorer removes the delay when  `touch-action` css property is set to `none` or `manipulation`
- Since iOs 8, Safari removes the delay on so-called "slow taps"

See this [article by Telerik](http://developer.telerik.com/featured/300-ms-click-delay-ios-8/) for more info on the topic.
Note that this change does not affect the `ngSwipe` directive.
Narretz added a commit to Narretz/angular.js that referenced this issue Jan 27, 2016
This commit deprecates the ngClick directive from the ngTouch module.
Additionally, it disables it by default. It can be enabled in the new $touchProvider with
$touchProvider.ngClickOverrideEnabled() method.

The directive was conceived to remove the 300ms delay
for click events on mobile browsers, by sending a synthetic click event on touchstart.
It also tried to make sure that the original click event that the browser sends after 300ms
was "busted", so that no redundant "ghost-clicks" appear.

There are various reasons why the directive is being deprecated.

- "This is an ugly, terrible hack!" (says so in the source)
- It is plagued by various bugs that are hard to fix / test for all platforms (see below)
- Simply including ngTouch activates the ngClick override, which means even if you simply want
to use ngSwipe, you may break parts of your app
- There exist alternatives for removing the 300ms delay, that can be used very well with Angular:
[FastClick](https://github.com/ftlabs/fastclick), [Tappy!](https://github.com/filamentgroup/tappy/)
(There's also hammer.js for touch events / gestures)
- The 300ms delay itself is on the way out - Chrome and Firefox for Android remove the 300ms delay
when the usual `<meta name="viewport" content="width=device-width">` is set. In IE, the
`touch-action` css property can be set to `none` or `manipulation` to remove the delay. Finally,
since iOs 8, Safari doesn't delay "slow" taps anymore. There are some caveats though, which can be
found in this excellent article on which this summary is based: http://developer.telerik.com/featured/300-ms-click-delay-ios-8/

Note that this change does not affect the `ngSwipe` directive.

Issues with interactive elements (input, a etc.) when parent element has ngClick:
Closes angular#4030
Closes angular#5307
Closes angular#6001
Closes angular#6432
Closes angular#7231
Closes angular#11358
Closes angular#12082
Closes angular#12153
Closes angular#12392
Closes angular#12545
Closes angular#12867
Closes angular#13213
Closes angular#13558

Other issues:
- incorrect event order
- incorrect event propagation
- ghost-clicks / failing clickbusting with corner cases
- browser specific bugs
- et al.

Closes angular#3296
Closes angular#3347
Closes angular#3447
Closes angular#3999
Closes angular#4428
Closes angular#6251
Closes angular#6330
Closes angular#7134
Closes angular#7935
Closes angular#9724
Closes angular#9744
Closes angular#9872
Closes angular#10211
Closes angular#10366
Closes angular#10918
Closes angular#11197
Closes angular#11261
Closes angular#11342
Closes angular#11577
Closes angular#12150
Closes angular#12317
Closes angular#12455
Closes angular#12734
Closes angular#13122
Closes angular#13272
Closes angular#13447

BREAKING CHANGE:

The `ngClick` override directive from the `ngTouch` module is **deprecated and disabled by default**.
This means that on touch-based devices, users might now experience a 300ms delay before a click event is fired.

If you rely on this directive, you can still enable it with the `$touchProvider.ngClickOverrideEnabled()`method:

```js
angular.module('myApp').config(function($touchProvider) {
  $touchProvider.ngClickOverrideEnabled(true);
});
```

For migration, we recommend using [FastClick](https://github.com/ftlabs/fastclick).
Also note that modern browsers remove the 300ms delay under some circumstances:
- Chrome and Firefox for Android remove the 300ms delay when the well-known `<meta name="viewport" content="width=device-width">` is set
- Internet Explorer removes the delay when  `touch-action` css property is set to `none` or `manipulation`
- Since iOs 8, Safari removes the delay on so-called "slow taps"

See this [article by Telerik](http://developer.telerik.com/featured/300-ms-click-delay-ios-8/) for more info on the topic.
Note that this change does not affect the `ngSwipe` directive.
@sinta
Copy link

sinta commented Feb 3, 2016

@Narretz From where can i get the latest ngTouch library file with ngClickOverride fix?

@Narretz
Copy link
Contributor

Narretz commented Feb 3, 2016

The change is in 1.5.0-rc.2. So it's not in any 1.4 branch. That's because it's not a bug fix, we simply decided to disable the ngClick.override directive. You should be able to use ngTouch .5 with 1.4 though

amatriain added a commit to amatriain/feedbunch that referenced this issue Feb 4, 2016
…itialization.

Angular-touch 1.5 will deprecate and disable by default the removal of the 300ms delay in touchscreens. They recommend using fastclick or Tappy instead. This commit prepares for when angular 1.5 is included.

The reason for the deprecation is that the ng-touch version of ngClick has never worked properly, causing issues with phantom touch events. Also browsers are smarter these days, imposing the 300ms delay in few cases (but fastclick.js is still necessary, e.g. for homescreen web apps in iOS). For more about this deprecation see:

  angular/angular.js#6251
  angular/angular.js@0dfc1df
  http://developer.telerik.com/featured/300-ms-click-delay-ios-8/
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.