Hi Guys,
I’ve noticed the autofocus on the ionic popup stopped working for me… Don’t actually understand why but I’ve adapted a codepen and it still doesn’t autofocus on the input box
I’m running the last version (rc2)
Hi Guys,
I’ve noticed the autofocus on the ionic popup stopped working for me… Don’t actually understand why but I’ve adapted a codepen and it still doesn’t autofocus on the input box
I’m running the last version (rc2)
Ionic doesn’t play well with autofocus.
Instead, use a directive like this:
.directive('focusMe', function($timeout) {
return {
link: function(scope, element, attrs) {
$timeout(function() {
element[0].focus();
}, 150);
}
};
})
I’ve used something similiar but it doesn’t seem to work on iOS. Could it be related to the new iOS update ? I’m using iOS 8.3 and it was working before with the autofocus html tag on the input element.
I am experiencing same problem after upgrading to iOS 8.3. Neither the ionic autofocus directive or the directive mentioned in @jack2’s post will work.
I am not using ionic with this project but started to have a similar issue after updating to iOS 8.3. This may also be related https://github.com/meteoric/meteor-ionic/issues/97
Going to try adding a timeout to see if it fixes the issue
elem.on('keyup', function(e){
if(!isNaN(parseInt(String.fromCharCode(e.keyCode)))){
this.value = String.fromCharCode(e.keyCode);
if(this.nextElementSibling){
this.nextElementSibling.focus();
}
}
});