Cordova / UserAccounts: Keyboard not showing up in iOS if user taps username field

This is driving me crazy :confused:

I am using the useraccounts:bootstrap package in a Cordova application, with the out-of-the-box {{> atForm}} form. Iā€™ve customized it a bit, based on the docs, so there is a combined username/e-mail field instead that lets the user enter either of these to log in.

Everything works perfectly on Android. If the user taps the username field, the keyboard shows up immediately and you can enter your credentials. But on my iPad, the keyboard does not show up. Well, it does, but only after I tap the input box approx. 10 times in succession. Strange thing is that the password field below the username field behaves much better. It sometimes does not react on the first tap, but most often would at least open on the second tap. But the username field behaves much worse.

According to the HTML, both fields are nearly identical (besides their idā€™s, of course). So I have no clue what is the root cause of this strange behaviour. I also tried to disable fastclick for the fields, by adding the needsclick class programmatically, but this did not change anything.

This problem only occurs with the UserAccounts form. Other text inputs in my app work just fine.

Did anybody experience the same odd behaviour and found a solution to it? Any help would be appreciatedā€¦

That drove us nuts too. It would seem to freeze for between 2 and 10 seconds while it sorted something out - no idea what - but we found that by not setting focus on the email field in the render function the problem was resolved.

Not the first focus issue weā€™ve had on iOS, so itā€™s something to keep in mind as a potential cause for these sorts of issues.

Hopefully this solves your problem.

Thanks for your suggestion. Unfortunately, I havenā€™t set any focus on the field, so there is nothing that could be removed. I even tried to add a focus to solve the problem, but this made things even worse, so I removed the focus again.

Bump. Any other ideas / approaches from the community? Iā€™m quite desperate on thisā€¦ Thanks in advance for any advice.

@waldgeist Is it possible that the field tries to request an autofocus? I just had a ā€œlaggingā€ issue when I did a $(input).focus() on my iPhone after rendering my template. Iā€™ve added this to my mobile-config:

App.setPreference("KeyboardDisplayRequiresUserAction",false);

I donā€™t know exactly, because it is the standard {{> atForm}} template of the useraccounts package. Maybe they hook something in. But I will try your preference and look if its getting better by setting this! Thanks for this tip.

Do you think the new setting might conflict with the Cordova keyboard plugin? I am using this plugin for shrinking the web-view on iOS if the keyboard comes up.

Hey, I think this was it! After Iā€™ve set this option, the user input field is automatically highlighted on startup. Seems as if useraccounts does this for convenience.

Thanks a million for pointing me to this preference setting. Frustrating the user on the very first app page was not a good idea, so I am really glad this is solved now.

EDIT: Just saw this was implemented on request: https://github.com/meteor-useraccounts/core/issues/384, and