9

I have a problem with the KeyboardShrinksView feature that is included in Phonegap 2.6 (ios).

When I tap in the textarea where I want to include text, the keyboard appears and the webview is contracted as I wanted.

The problem is that I lose the focus on the textarea and the user has to tap again in the text area to start writing in it.

Is anyone having the same problem with this new feature?

Thanks!!

3 Answers 3

4

add a tap (or touchstart) event on your input which will focus on your field.

element.on("tap", function(e){element.focus()});

The issue comes from the fact that focus is done on ios using the ghost click event. But the view has already changed (because of the keyboard) when it's fired.

This problem will be even more common on ios7 since KeyboardShrinksView is the default behavior...

1
  • 1
    Don't know why, but for me the touchend event seemed to do the trick May 7, 2014 at 2:48
1

After the web view is contracted try writing this code.

  [TextFieldOnWhichFocusIsExpected BecomeFirstResponder];
0

I ran into this problem for iOS after upgrading from Phonegap 2.9 to 3.1. Solved by adding height=device-height to my meta tag, so it now looks like this:

<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.