Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3a2185e

Browse files
committedJan 26, 2016
fix(ngTouch): remove ngClick override
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 #13287 Closes #13558 Closes #12392 Closes #12153 Closes #11358 Closes #6432 Closes #12867 Closes #7231 Closes #13213 Closes #12082 Closes #4030 Closes #12545 Closes #6001 Closes #5307 Other issues: - incorrect event order - incorrect event propagation - ghost-clicks / failing clickbusting with corner cases - browser specific bugs - et al. Closes #12734 Closes #12455 Closes #11197 Closes #11261 Closes #12150 Closes #10918 Closes #10366 Closes #9872 Closes #9744 Closes #6251 Closes #4428 Closes #3999 Closes #3347 Closes #3296 Closes #7935 Closes #13272 Closes #13447 Closes #13122 Closes #12317 Closes #11577 Closes #11342 Closes #10211 Closes #9724 Closes #7134 Closes #6330 Closes #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/
1 parent adcfa74 commit 3a2185e

File tree

4 files changed

+8
-956
lines changed

4 files changed

+8
-956
lines changed
 

‎angularFiles.js

-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ var angularFiles = {
138138
'ngTouch': [
139139
'src/ngTouch/touch.js',
140140
'src/ngTouch/swipe.js',
141-
'src/ngTouch/directive/ngClick.js',
142141
'src/ngTouch/directive/ngSwipe.js'
143142
],
144143
'ngAria': [

‎src/ngTouch/directive/ngClick.js

-296
This file was deleted.

‎src/ngTouch/touch.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@
77
*
88
* # ngTouch
99
*
10-
* The `ngTouch` module provides touch events and other helpers for touch-enabled devices.
11-
* The implementation is based on jQuery Mobile touch event handling
12-
* ([jquerymobile.com](http://jquerymobile.com/)).
10+
* The `ngTouch` module provides the touch-event based {@link ngTouch.$swipe `$swipe`} directive.
1311
*
12+
* <div class="alert alert-info">
13+
* Angular 1.5.0 has **removed** the override to the `ngClick` directive that eliminates the 300ms delay
14+
* after a tap on mobile browsers. It was removed because the implementation was unreliable, and because
15+
* the 300ms delay is on its way out on modern mobile browsers.
16+
* If you need this behavior, consider using [FastClick](https://github.com/ftlabs/fastclick) or
17+
* [Tappy!](https://github.com/filamentgroup/tappy/)
18+
* </div>
1419
*
15-
* See {@link ngTouch.$swipe `$swipe`} for usage.
1620
*
1721
* <div doc-module-components="ngTouch"></div>
1822
*

‎test/ngTouch/directive/ngClickSpec.js

-655
This file was deleted.

0 commit comments

Comments
 (0)
This repository has been archived.