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


#1

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…


#2

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.


#3

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.


#4

Bump. Any other ideas / approaches from the community? I’m quite desperate on this… Thanks in advance for any advice.


#5

@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);

#6

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.


#7

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