I have a screen with 3 input fields, whenever i navigate to it the second input field gets focus and raises the keyboard. I can’t figure out why, it doesn’t happen in the browser and there’s nothing special with the second input.
This is on Android 4.3 using the Nightly Build, on a browser (chrome) the field doesn’t get focus and works as expected.
By chance, is the 2nd input field in the same location as where you last tapped to go to the new view? What I’m getting at is whether the previous tap is causing the focus due to some delay?
Questions :
Can you try this on Beta 2 with the same code?
Can you post a CodePen sample of the exact code? Someone can then try to put it in a local project for testing.
I’m having the same issue intermittently (on ios in my case) and I think you’ve figured it out. If the tap is in the same position as the input on the next screen, the input gets focused incorrectly.
It must have something to do with timing. If i put in an alert in my controller that handles the destination page then the autofocus doesn’t happen. Maybe this gives the touch time to be “over” before the template is brought up. If I remember right Ionic does something with x and y coordinates to get around the browser 300ms delay in touch vs click. Maybe it’s something in that code.
It’s going to be really hard for the devs to come up with a fix for something they might not be able to reproduce. If you can post a CodePen sample of your code and then open an Issue that would be best. Admittedly, the CodePen won’t work right on the phone, but they can easily put it in a local demo app for testing on device.
I just did a little hack/workaround in my app that suppresses this issue without really affecting the user experience. Basically the approach is to cover the inputs with an invisible div so that the input focus isn’t transferred and then hide this invisible div after half a second or so, before user would actually tap anything. Hacky, but works well enough for my app so far.