Skip to content

Commit c235450

Browse files
committed
fix(ngTouch): don't blur form elements
Form element focus should not be prevented by ng-click. The issue was introduced by angular#2989, and happens on mobile browsers that support touch events. Plunker to demonstrate the issue: http://embed.plnkr.co/CxeuWocoPE70vzrevrIi Closes angular#4030, angular#6432
1 parent 6333d65 commit c235450

File tree

2 files changed

+0
-15
lines changed

2 files changed

+0
-15
lines changed

src/ngTouch/directive/ngClick.js

-3
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,6 @@ ngTouch.directive('ngClick', ['$parse', '$timeout', '$rootElement',
158158
// If we didn't find an allowable region, bust the click.
159159
event.stopPropagation();
160160
event.preventDefault();
161-
162-
// Blur focused form elements
163-
event.target && event.target.blur && event.target.blur();
164161
}
165162

166163

test/ngTouch/directive/ngClickSpec.js

-12
Original file line numberDiff line numberDiff line change
@@ -314,18 +314,6 @@ describe('ngClick (touch)', function() {
314314

315315
expect($rootScope.count1).toBe(1);
316316

317-
time = 90;
318-
// Verify that it is blured so we don't get soft-keyboard
319-
element1[0].blur = jasmine.createSpy('blur');
320-
browserTrigger(element1, 'click',{
321-
keys: [],
322-
x: 10,
323-
y: 10
324-
});
325-
expect(element1[0].blur).toHaveBeenCalled();
326-
327-
expect($rootScope.count1).toBe(1);
328-
329317
time = 100;
330318
browserTrigger(element1, 'touchstart',{
331319
keys: [],

0 commit comments

Comments
 (0)