Skip to content

Commit aef490b

Browse files
committed
fix(input): focus on iOS
1 parent d9b35f4 commit aef490b

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

js/angular/directive/input.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ IonicModule
9292
ionInputCtrl.setInputAriaLabeledBy(id);
9393

9494
$element.on('click', function() {
95-
$timeout(function() {
96-
ionInputCtrl.focus();
97-
});
95+
ionInputCtrl.focus();
9896
});
9997
}
10098
};

js/utils/tap.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ function tapMouseDown(e) {
358358
if (e.isIonicTap || tapIgnoreEvent(e)) return null;
359359

360360
if (tapEnabledTouchEvents) {
361-
console.log('mousedown', 'stop event');
361+
//console.log('mousedown', 'stop event');
362362
e.stopPropagation();
363363

364364
if (!ionic.Platform.isEdge() && (!ionic.tap.isTextInput(e.target) || tapLastTouchTarget !== e.target) &&
@@ -432,7 +432,7 @@ function tapTouchStart(e) {
432432
var textInput = tapTargetElement(tapContainingElement(e.target));
433433
if (textInput !== tapActiveEle) {
434434
// don't preventDefault on an already focused input or else iOS's text caret isn't usable
435-
console.log('Would prevent default here');
435+
//console.log('Would prevent default here');
436436
e.preventDefault();
437437
}
438438
}
@@ -507,7 +507,7 @@ function tapHandleFocus(ele) {
507507
// already is the active element and has focus
508508
triggerFocusIn = true;
509509

510-
} else if ((/^(input|textarea)$/i).test(ele.tagName) || ele.isContentEditable) {
510+
} else if ((/^(input|textarea|ion-label)$/i).test(ele.tagName) || ele.isContentEditable) {
511511
triggerFocusIn = true;
512512
ele.focus && ele.focus();
513513
ele.value = ele.value;
@@ -530,7 +530,7 @@ function tapHandleFocus(ele) {
530530
function tapFocusOutActive() {
531531
var ele = tapActiveElement();
532532
if (ele && ((/^(input|textarea|select)$/i).test(ele.tagName) || ele.isContentEditable)) {
533-
console.log('tapFocusOutActive', ele.tagName);
533+
//console.log('tapFocusOutActive', ele.tagName);
534534
ele.blur();
535535
}
536536
tapActiveElement(null);
@@ -551,7 +551,7 @@ function tapFocusIn(e) {
551551
// 2) There is an active element which is a text input
552552
// 3) A text input was just set to be focused on by a touch event
553553
// 4) A new focus has been set, however the target isn't the one the touch event wanted
554-
console.log('focusin', 'tapTouchFocusedInput');
554+
//console.log('focusin', 'tapTouchFocusedInput');
555555
tapTouchFocusedInput.focus();
556556
tapTouchFocusedInput = null;
557557
}

0 commit comments

Comments
 (0)