diff options
| author | Jan Laußmann | 2013-06-17 16:58:13 +0200 |
|---|---|---|
| committer | Misko Hevery | 2013-07-31 16:08:00 -0700 |
| commit | 0bbd20f255b2954b5c41617fe718cf6eca36a972 (patch) | |
| tree | 7b6a9d02f920b820186852ec72244ab08a6f083f | |
| parent | 3fdbe81a337c39027929c415e719493755cd8583 (diff) | |
| download | angular.js-0bbd20f255b2954b5c41617fe718cf6eca36a972.tar.bz2 | |
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.
| -rw-r--r-- | src/ngMobile/directive/ngClick.js | 3 | ||||
| -rw-r--r-- | test/ngMobile/directive/ngClickSpec.js | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/ngMobile/directive/ngClick.js b/src/ngMobile/directive/ngClick.js index 51e201c2..6df71ddb 100644 --- a/src/ngMobile/directive/ngClick.js +++ b/src/ngMobile/directive/ngClick.js @@ -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(); } diff --git a/test/ngMobile/directive/ngClickSpec.js b/test/ngMobile/directive/ngClickSpec.js index 9038514c..52394977 100644 --- a/test/ngMobile/directive/ngClickSpec.js +++ b/test/ngMobile/directive/ngClickSpec.js @@ -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); |
