@@ -95,6 +95,12 @@ var keyboardLandscapeViewportHeight = 0;
95
95
*/
96
96
var keyboardActiveElement ;
97
97
98
+ /**
99
+ * The previously focused input used to reset keyboard after focusing on a
100
+ * new non-keyboard element
101
+ */
102
+ var lastKeyboardActiveElement ;
103
+
98
104
/**
99
105
* The scroll view containing the currently focused input.
100
106
*/
@@ -311,6 +317,9 @@ function keyboardFocusIn(e) {
311
317
e . target . readOnly ||
312
318
! ionic . tap . isKeyboardElement ( e . target ) ||
313
319
! ( scrollView = ionic . DomUtil . getParentWithClass ( e . target , SCROLL_CONTAINER_CSS ) ) ) {
320
+ if ( keyboardActiveElement ) {
321
+ lastKeyboardActiveElement = keyboardActiveElement ;
322
+ }
314
323
keyboardActiveElement = null ;
315
324
return ;
316
325
}
@@ -546,9 +555,9 @@ function keyboardHide() {
546
555
ionic . keyboard . isOpen = false ;
547
556
ionic . keyboard . isClosing = false ;
548
557
549
- if ( keyboardActiveElement ) {
558
+ if ( keyboardActiveElement || lastKeyboardActiveElement ) {
550
559
ionic . trigger ( 'resetScrollView' , {
551
- target : keyboardActiveElement
560
+ target : keyboardActiveElement || lastKeyboardActiveElement
552
561
} , true ) ;
553
562
}
554
563
@@ -572,6 +581,7 @@ function keyboardHide() {
572
581
}
573
582
574
583
keyboardActiveElement = null ;
584
+ lastKeyboardActiveElement = null ;
575
585
}
576
586
577
587
/**
0 commit comments