-
Notifications
You must be signed in to change notification settings - Fork 27.5k
fix(ngMobile): prevent ngClick when item disabled #3137
Conversation
revolunet
commented
Jul 5, 2013
- the ngClick attribute was always triggered, regardless the ngDisabled/disabled attributes
- we now check the ngDisabled status before triggering the original click event
- and also check the DOM disabled attribute to be homogenous with the regular HTML disabled behavior (disable presence makes the element and click disabled)
- deals with ngMobile's overridden ngClick directive ignores the disabled attribute of a button element #3124 ngMobile's overridden ngClick directive fails to bust the click event #3132 /cc @shepheb
sample plnkr with fix inside : http://plnkr.co/edit/x0ErHC |
Firstly after looking at the PR, I'm not sure this fixes the #3132 issue. I tested the plunker you provided with the iPhone 6.1 Simulator and this does prevent the event from firing as expected, but it doesn't trigger the alert for any of the buttons, where I believe it should for: ng-click + ng-disabled="false" I've not had a chance to test on the actual device yet, but I see not reason why the results should differ. |
ok this PR needs some more work. closing it right now :/ |
@davgothic please help me resolve this. Ive updated the plnkr : http://run.plnkr.co/plunks/x0ErHC/ works ok for me There was a |
I've just tested the revised plunk in the iPhone 6.1 and Android 4.2.2 Simulators and it seems the previous issues are now fixed and all buttons appear to behave as expected. I don't know the ngMobile module to well so I've no idea if setting Thanks @revolunet |
My assumption is that the CLICKBUSTER_THRESHOLD is used to distinguish between a tap and a click on mobile (since double tap is used frequently in mobile apps to zoom). But that's without diving into the code :). ngMobile is very early and very likely to change. |
Would be great if the original author could give a hand here. This buggy
|
Jeff's guess at @revolunet can you expand on what was going wrong with the original value of 25? I don't understand what issues you were seeing. The disabling part of this PR looks good to me. |
Thanks @shepheb cool to see you back here :) When you have |
Another question : should'nt we trigger |
Here's an example for iPad : http://plnkr.co/edit/2nGH8g?p=preview
|
the part of the PR that handles disabled elements has landed as e034024 |
I'm closing this. @revolunet feel free to open another bug/PR about the |