mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
fix(mobile-ng-click): prevent unwanted opening of the soft keyboard
Ghost clicks are busted but the corresponding form elements are still focused. This means that for example on smartphones the soft keyboard will be opened. This pull request prevents the unwanted opening of the soft keyboard.
This commit is contained in:
parent
3fdbe81a33
commit
0bbd20f255
2 changed files with 6 additions and 0 deletions
|
|
@ -135,6 +135,9 @@ ngMobile.directive('ngClick', ['$parse', '$timeout', '$rootElement',
|
|||
// If we didn't find an allowable region, bust the click.
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
// Blur focused form elements
|
||||
event.target && event.target.blur();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -211,7 +211,10 @@ describe('ngClick (mobile)', function() {
|
|||
expect($rootScope.count1).toBe(1);
|
||||
|
||||
time = 90;
|
||||
// Verify that it is blured so we don't get soft-keyboard
|
||||
element1[0].blur = jasmine.createSpy('blur');
|
||||
browserTrigger(element1, 'click', [], 10, 10);
|
||||
expect(element1[0].blur).toHaveBeenCalled();
|
||||
|
||||
expect($rootScope.count1).toBe(1);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue