@@ -125,6 +125,9 @@ ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement',
125
125
return ; // Too old.
126
126
}
127
127
128
+ // Get the node name of the target
129
+ var nodeName = nodeName_ ( event . target ) ;
130
+
128
131
var touches = event . touches && event . touches . length ? event . touches : [ event ] ;
129
132
var x = touches [ 0 ] . clientX ;
130
133
var y = touches [ 0 ] . clientY ;
@@ -144,7 +147,7 @@ ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement',
144
147
lastLabelClickCoordinates = null ;
145
148
}
146
149
// remember label click coordinates to prevent click busting of trigger click event on input
147
- if ( nodeName_ ( event . target ) === 'label' ) {
150
+ if ( nodeName === 'label' ) {
148
151
lastLabelClickCoordinates = [ x , y ] ;
149
152
}
150
153
@@ -159,8 +162,14 @@ ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement',
159
162
event . stopPropagation ( ) ;
160
163
event . preventDefault ( ) ;
161
164
162
- // Blur focused form elements
163
- event . target && event . target . blur && event . target . blur ( ) ;
165
+ // Check if the target node is not of the type input.
166
+ // All targets should be blurred except input to prevent the keyboard from
167
+ // bouncing in and out and sometimes not showing.
168
+ if ( nodeName !== 'input' && nodeName !== 'textarea' ) {
169
+ // Blur focused form elements
170
+ event . target && event . target . blur && event . target . blur ( ) ;
171
+ }
172
+
164
173
}
165
174
166
175
@@ -238,6 +247,9 @@ ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement',
238
247
element . on ( 'touchend' , function ( event ) {
239
248
var diff = Date . now ( ) - startTime ;
240
249
250
+ // Get the node name of the tapElement
251
+ var nodeName = nodeName_ ( tapElement ) ;
252
+
241
253
// Use jQuery originalEvent
242
254
var originalEvent = event . originalEvent || event ;
243
255
var touches = ( originalEvent . changedTouches && originalEvent . changedTouches . length ) ?
@@ -255,7 +267,9 @@ ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement',
255
267
// Blur the focused element (the button, probably) before firing the callback.
256
268
// This doesn't work perfectly on Android Chrome, but seems to work elsewhere.
257
269
// I couldn't get anything to work reliably on Android Chrome.
258
- if ( tapElement ) {
270
+ // Make sure the tapElement isn't of type input to prevent the keyboard from
271
+ // bouncing and possibly not showing without a few attempted clicks.
272
+ if ( tapElement && nodeName !== 'input' && nodeName !== 'textarea' ) {
259
273
tapElement . blur ( ) ;
260
274
}
261
275
@@ -293,4 +307,3 @@ ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement',
293
307
294
308
} ;
295
309
} ] ) ;
296
-
0 commit comments