Closed elirov closed 8 years ago
+1
Has anyone else been able to reproduce this using my plnkr on their iPad device?
Yes.
Anyone have any idea what could be causing this? Looking quickly at the ngMobile code, I don't really see anything that depends on something that jQuery would override. Very strange.
Same issue here
Looks like there is a PR for this https://github.com/angular/angular.js/pull/2773
PR #2773 was obsoleted recently, with #3198 taking over. That PR is on track to be merged soon.
:+1:
Seems that it is still not merged...
It looks like that PR was closed. Is there something that supercedes it?
This is still happening with Angular 1.2.0-rc.2. Until it's fixed the FastClick library seems to do the trick. https://github.com/ftlabs/fastclick
I agree, this is still broken in my opinion. seeing delay with 1.2.0rc.2 trying out rc 3 now.
I tried with rc3 - and still see the delay. Hm.
I am seeing it still as well with rc3. this basically makes ng-touch unusable with a delay. hopefully will make it into final release.
I have this problem without jQuery. Tried adding Fastclick, and there was a clear improvement.
angular-gestures package is what I am running now. it ports all of the hammerjs library touch related events to angular. I have used hammerjs before on other projects and it's working great. it just sucks that the supposedly built in one isn't actually working. it says its based on jquery mobile tap event, which could explain it as i've only had bad experiences with that.
@kellyrmilligan, thanks for the tip. It looks great, except for one thing: it seems I would have to replace all my ng-clicks with hm-taps... It would be better with something that works both on PC and mobile with the same event handler directive. So that the same code can be used on different platforms...
i'm working with rc3 and couldn't make it work with Jquery. Getting rid of JQuery solved the problem for me and now touch events are catched by the angular-touch ng-click directive.
@perqa hammerjs will delegate to click when on a desktop browser, but you are right that all your ng-clicks would become hm-taps...
@kellyrmilligan, I think that's alright. As long as I don't need to maintain two different versions of the codebase, I'm happy. Thanks for sharing! :-)
@perqa @kellyrmilligan You should be able to stick with ng-click and fastclick, no need to replace everything with hm-tap if you are using fastclick unless you want to use hammer for more complex touch movements like drag and swipe. I haven't had any problems using fastclick and hammer together this way.
@damrbaby OK, that's also good to know. Thanks!
Yeap... same issue. 300ms'ish delay on ngclick when jquery is referenced while injecting ngtouch...
Is there an angular specific implementation for fast-click? I agree if all you need is a solid tap event, that would be preferred. @damrbaby
@kellyrmilligan There does not need to be an angular-specific implementation of fastclick, all you need is fastclick.js and the following code outside the context of any angular code:
window.addEventListener('load', function () {
FastClick.attach(document.body);
}, false);
The above will essentially turn all ng-clicks and any other click events into tap events, without the use of ngTouch
(formerly ngMobile
). However it does not conflict with ngTouch
either if you have to include both, e.g. if you need ngTouch
for swipe events.
I am having the same problem. Using jQuery - 1.9.1 and AngularJS 1.2 ngTouch library.
event.returnValue is deprecated. Please use the standard event.preventDefault() instead.
ng-click example on documentation page of ngTouch has the same problem. When I tap the "increment" button on touch screen, it is has 300ms delay. Tested on iPad 2 with iOS 7.
Well, I tried to come up with something a bit different than the current implementation of the ngTouch ngClick...
The only problems I'm having with this implementation currently are the following:
Sooo, a proper fastclick (but not really?)
However, a problem I'm having here, is that when tapping the input field, the software keyboard shows up very briefly (mortal kombat "toasty" style). This was tested on iOS7. The stock browser on android or chrome on android doesn't give focus either.
It loses focus almost instantly. Holding down your finger on it, gives the field a proper focus. The stock browser on android and chrome on anrdoid selects some text but does not give focus at all... I guess an issue should be logged for this if there isn't one already.
Here everything works as expected, but with the delay... :-1:
Are there any plans to eliminate this issue in future versions?
This issue is still present in AngularJS version 1.3.0-beta.15, combined with jQuery version 2.1.0.
This is really a deal breaker. I don't want to include any other libraries like FastClick, but I can't let go of jQuery.
:+1:
This issue should really be stated in ngTouch's documentation.
it's more like a bug to be fixed, really --- if we make it work with jqLite, is there some reason why it doesn't work with jQuery?
I agree it should be fixed, but the ngClick documentation for ngTouch states:
A more powerful replacement for the default ngClick designed to be used on touchscreen devices. Most mobile browsers wait about 300ms after a tap-and-release before sending the click event. This version handles them immediately, and then prevents the following click event from propagating.
The sole purpose of this directive is to avoid this delay. When it's not functioning with a library that is so widely used, it should be stated.
edit: I say this because it would have saved me a lot of headache
This still doesn't appear to be fixed in 1.4. Due to conflicts with ngTouch and FastClick that have appeared (particularly with hover styles) I've simply removed ngTouch altogether and gone with Fastclick alone as the solution. This doesn't seem like it's going to get fixed.
I have reason to assume that this was fixed by 06a9f0a95f0e72fa2e9879fe8a49e9bf69986a5f
http://plnkr.co/edit/fnJCUMn2fMZy9cIunfFj
If we leave the jquery include commented out, the ng-click responds quickly on my ipad. If we add the jquery include back in, then the click seems to revert back to the slow click behavior.