Focusing an input element


Mobile safari does not seem to support the way we are using element.focus() for example in the ionicPopup where there is a text input element. The focus just doesn’t work – and actually seems to freeze the element momentarily. I haven’t tried this is Cordova.

It would be awesome if there was a workaround for this.


Hmm, can you provide you code for how your setting focus?

Anything similar to this .


Yes I tried

$timeout(function() {

The problem also happens with the built-in feature in Ionic, namely $ which sets focus when there is a <input> in the popup content. Doesn’t work on mobile safari; the input just freezes.


Do you also have the keyboard plugin installed?


No, but did you see that this is on mobile safari without phonegap/cordova?


Ha I did now :smile:

Do you mind throwing this into a codepen? I’ll give this a try and see if I can find the issue.


On this codepen from beta4 ionic the Prompt button’s popup doesn’t focus (on my phone, but does in desktop). Of interest though is that the Password Prompt and the “Multiple” do lead to a focus. I wonder if those were implemented any differently.