-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(ngTouch): remove ngClick override and $touchProvider.ngClickOverr… #15761
Conversation
src/ngTouch/touch.js
Outdated
* | ||
* @returns {*} current value of `ngClickOverrideEnabled` set in the {@link ngTouch.$touchProvider $touchProvider}, | ||
* i.e. if {@link ngTouch.ngClick ngTouch's ngClick} directive is enabled. | ||
* * |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A redundant line? Also, an extra *
.
src/ngTouch/touch.js
Outdated
|
||
/** | ||
* @ngdoc service | ||
* @name $touch | ||
* @kind object | ||
* | ||
* @description | ||
* Provides the {@link ngTouch.$touch#ngClickOverrideEnabled `ngClickOverrideEnabled`} method. | ||
* Provides the legacy {@link ngTouch.$touch#ngClickOverrideEnabled `ngClickOverrideEnabled`} method. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we deprecate it at the same time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason to keep this, if we are removing ngClick
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gkalpak It's all explained in the first post of the pull request. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, we are supposed to read that, right? Doh!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, it looks like material never implemented a check with ngClickOverrideEnabled, it simply is not compatible with ngTouch: https://github.com/angular/material/blob/24370e7627389a873a95777f8bebc8bb43c842ce/src/core/core.js#L23
I think that means we can remove $touch.ngClickOverrideEnabled
I doubt that anyone else uses it (famous last words)
This is unclear to me - if there was no
Why does a person using the override have to migrate to a different solution? This doesn't break the app and in current mobile browsers the click delay is disabled in many situations anyway so it may very well be redundant. If we're keeping the method on |
Good point. It turns out material never used the $touch service. FWIW, you can use $injector.has() or try-catch to find out if a service is available or not.
They don't have to, but I assume they want to. If they are on 1.6, they have to opt-in to the ngClick override, soif they did that, they want this behavior, which means they want it in the future, too. |
I think we should remove the |
I've removed the fn on the service, PTAL |
How long do we want to keep the noop |
I've kept it in case we want to put some stuff on it in the future. At the same time I think this is unlikely and what we should do instead is to deprecate ngTouch completely. |
1a4add9
to
015c837
Compare
Why deprecate |
My main point is that we have a few open PRs and bugs about ngSwipe that we will probably never merge / fix because we don't have the resource to test and make sure they work on all platforms. There are other touch gestures libraries that can provide this stuff, we should really focus on the core. There's also not touch stuff in Angular, it's either material or something 3rd party. |
I guess it makes sense to not keep this zombie stuff here then. |
With Zombie stuff you mean the $touchProvider? |
The whole ngTouch, if we're not really maintaining it. |
In jQuery we have a separate org - https://github.com/jquery-archive/ - where we keep projects that we no longer maintain. Were we to remove ngTouch completely one day we could put it somewhere for others to pick up if they want. |
That is where |
I think I have a PR for removing ngScenario lying around. And in that case, I will remove the $touchProvider completely. |
We were trying to get someone in the community to take ownership of ngScenario in https://github.com/angular/ngScenario but no one stepped up. Perhaps if we remove it in 1.7/8 then it will trigger more interest? |
@Narretz Regarding the |
I agree with @mgol that the commit message should point to documentation (not necessarily ours) on best practices for this sort of thing rather than just pointing to fastclick. Otherwise LGTM (for master only) |
9cd0d1f
to
050db20
Compare
Closes angular#15761 Closes angular#15755 BREAKING CHANGE: The `ngClick` directive from the ngTouch module has been removed, and with the also the corresponding $touchProvider and $touch service. If you have included ngTouch in your application with version 1.5.0 or higher, and have not changed the value of $touchProvider.ngClickOverrideEnabled()`, or injected and used the $touch service, then there are no migration steps for your code. Otherwise you must remove references to the provider and service. The `ngClick` override directive had been deprecated and by default disabled since v1.5.0, because of buggy behavior in edge cases, and a general trend to avoid special touch based overrides of click events. In modern browsers, it should not be necessary to use a touch override library: - Chrome and Firefox for Android remove the 300ms delay when the well-known `<meta name="viewport" content="width=device-width">` is set. - Internet Explorer, Edge, and Chrome remove the delay when the `touch-action` css property is set to `none` or `manipulation`. - Since iOS 8, Safari removes the delay on so-called "slow taps". You can find out more in this Telerik article: http://developer.telerik.com/featured/300-ms-click-delay-ios-8/
…ideEnabled() Closes angular#15755 BREAKING CHANGE: The `ngClick` directive from the ngTouch module has been removed, and with the also the corresponding $touchProvider.ngClickOverrideEnabled() method. If you have included ngTouch in your application with a version of 1.5.0 or higher, and have not changed the value of $touchProvider.ngClickOverrideEnabled()`, then there are no migration steps. The `ngClick` override directive had been deprecated and by default disabled since v1.5.0, because of buggy behavior in edge cases, and a general trend to avoid special touch based overrides of click events. If you still need a touch override, consider using [Fastclick](https://github.com/ftlabs/fastclick). Note that the `$touch` service still offers the `ngClickOverrideEnabled()` function for libraries that want to detect if an app uses the click override. Starting with 1.7.0, it will always return `false`.
050db20
to
a0b569a
Compare
Closes angular#15761 Closes angular#15755 BREAKING CHANGE: The `ngClick` directive from the ngTouch module has been removed, and with the also the corresponding $touchProvider and $touch service. If you have included ngTouch in your application with version 1.5.0 or higher, and have not changed the value of $touchProvider.ngClickOverrideEnabled()`, or injected and used the $touch service, then there are no migration steps for your code. Otherwise you must remove references to the provider and service. The `ngClick` override directive had been deprecated and by default disabled since v1.5.0, because of buggy behavior in edge cases, and a general trend to avoid special touch based overrides of click events. In modern browsers, it should not be necessary to use a touch override library: - Chrome and Firefox for Android remove the 300ms delay when the well-known `<meta name="viewport" content="width=device-width">` is set. - Internet Explorer, Edge, and Chrome remove the delay when the `touch-action` css property is set to `none` or `manipulation`. - Since iOS 8, Safari removes the delay on so-called "slow taps". You can find out more in this Telerik article: http://developer.telerik.com/featured/300-ms-click-delay-ios-8/
I've updated the commit message (see last commit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Narretz Re commit msg:
and with the also the
A typo.
- Since iOS 8, Safari removes the delay on so-called "slow taps".
This is incomplete. I wouldn't even mention iOS 8 due to its low market share (https://developer.apple.com/support/app-store/) but only 9.3+ which have conditions very similar to Chrome/Firefox/Edge mobile:
https://developer.apple.com/library/content/releasenotes/General/WhatsNewInSafari/Articles/Safari_9_1.html#//apple_ref/doc/uid/TP40014305-CH10-SW8
Closes angular#15761 Closes angular#15755 BREAKING CHANGE: The `ngClick` directive from the ngTouch module has been removed, and with it the corresponding `$touchProvider` and `$touch` service. If you have included ngTouch v1.5.0 or higher in your application, and have not changed the value of `$touchProvider.ngClickOverrideEnabled()`, or injected and used the `$touch` service, then there are no migration steps for your code. Otherwise you must remove references to the provider and service. The `ngClick` override directive had been deprecated and by default disabled since v1.5.0, because of buggy behavior in edge cases, and a general trend to avoid special touch based overrides of click events. In modern browsers, it should not be necessary to use a touch override library: - Chrome, Firefox, Edge, and Safari remove the 300ms delay when `<meta name="viewport" content="width=device-width">` is set. - Internet Explorer 10+, Edge, Safari, and Chrome remove the delay on elements that have the `touch-action` css property is set to `manipulation`. You can find out more in these articles: https://developers.google.com/web/updates/2013/12/300ms-tap-delay-gone-away https://developer.apple.com/library/content/releasenotes/General/WhatsNewInSafari/Articles/Safari_9_1.html#//apple_ref/doc/uid/TP40014305-CH10-SW8 https://blogs.msdn.microsoft.com/ie/2015/02/24/pointer-events-w3c-recommendation-interoperable-touch-and-removing-the-dreaded-300ms-tap-delay/
a0b569a
to
48da68e
Compare
@mgol Updated again, PTAL |
Closes angular#15761 Closes angular#15755 BREAKING CHANGE: The `ngClick` directive from the ngTouch module has been removed, and with it the corresponding `$touchProvider` and `$touch` service. If you have included ngTouch v1.5.0 or higher in your application, and have not changed the value of `$touchProvider.ngClickOverrideEnabled()`, or injected and used the `$touch` service, then there are no migration steps for your code. Otherwise you must remove references to the provider and service. The `ngClick` override directive had been deprecated and by default disabled since v1.5.0, because of buggy behavior in edge cases, and a general trend to avoid special touch based overrides of click events. In modern browsers, it should not be necessary to use a touch override library: - Chrome, Firefox, Edge, and Safari remove the 300ms delay when `<meta name="viewport" content="width=device-width">` is set. - Internet Explorer 10+, Edge, Safari, and Chrome remove the delay on elements that have the `touch-action` css property is set to `manipulation`. You can find out more in these articles: https://developers.google.com/web/updates/2013/12/300ms-tap-delay-gone-away https://developer.apple.com/library/content/releasenotes/General/WhatsNewInSafari/Articles/Safari_9_1.html#//apple_ref/doc/uid/TP40014305-CH10-SW8 https://blogs.msdn.microsoft.com/ie/2015/02/24/pointer-events-w3c-recommendation-interoperable-touch-and-removing-the-dreaded-300ms-tap-delay/
…ideEnabled()
Closes #15755
BREAKING CHANGE:
The
ngClick
directive from the ngTouch module has been removed, and with the also thecorresponding $touchProvider.ngClickOverrideEnabled() method.
If you have included ngTouch in your application with a version of 1.5.0 or higher, and have not
changed the value of $touchProvider.ngClickOverrideEnabled()`, then there are no migration steps.
The
ngClick
override directive had been deprecated and by default disabled since v1.5.0,because of buggy behavior in edge cases, and a general trend to avoid special touch based
overrides of click events. If you still need a touch override, consider using
Fastclick.
Note that the
$touch
service still offers thengClickOverrideEnabled()
function forlibraries that want to detect if an app uses the click override. Starting with 1.7.0, it
will always return
false
.Other info:
This one is a bit tricky, as we have deprecated the ngClick directive, but at the same time introduced two new APIs: $touchProvider.ngClickOverrideEnabled and $touch.ngClickOverrideEnabled().
I have removed the former, because it's directly tied to the directive. I think that's fine, as someone who uses the ngClick override must migrate to a different solution anyway, and will see an error when he updates and the provider fn is missing. I've kept the actual provider for the unlikely case that we introduce new config for the ngTouch module.
I've also kept the $touch.ngClickOverrideEnabled() method, as this one is used by material to check if they should include their own touch stuff. I think if we removed this then they wouldn't be able to determine if the ngClick override is present (because ngTouch module but no $touch service could also mean a pre 1.5.0 version of ngTouch)