0

We are having a bug in our iOS app when using an HTML text input in a webview.

Here is the HTML :

<!doctype html>
<html>
<head>
    <title>Test</title>
</head>
<body>
    <input type="text"/>
</body>
</html>

If the input is tapped once, it works perfectly : it gets the focus and the keyboard appears, the user can type. However if the user taps again on the input, the cursor moves to the far left of the input and nothing that is typed appears in the input.

This bug can be seen on iOS7 and iOS8 devices in a webview. It does not appear in Safari or Chrome.

To see this behavior, I've uploaded this video.

I have tried to find a JS solution, playing with .focus(), without any success. Does anyone have a clue on where it might come from, or how to solve this?

blex
  • 24,941
  • 5
  • 39
  • 72
  • can you add your webview code? – Ammar Nov 20 '14 at 15:50
  • I have many applications using webview and they are working fine. If you can test on fly try to add this metatag in html head section: – Ammar Nov 20 '14 at 19:42
  • try to add this also to previous meta tag: user-scalable=no – Ammar Nov 20 '14 at 19:52
  • @blex I tried your code and it's working fine for me (iPhone5 iOS 8.1), are you doing any other process or this is the only HTML that you are loading in your WebView? – Yuvrajsinh Nov 25 '14 at 07:50
  • Found a workaround, see https://stackoverflow.com/questions/15278930/ipad-is-not-writing-text-in-the-input/34731858#34731858 – jusu Jan 11 '16 at 22:05

1 Answers1

0

Add this metatag in html head section:

<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, target-densityDpi=device-dpi, user-scalable=no" />
Ammar
  • 719
  • 6
  • 21
  • Hi and thank you for your answer. Unfortunately, it's not solving the issue. Maybe it is app-related... – blex Nov 24 '14 at 09:12
  • Even if that did not solve my problem, I am awarding you the bounty instead of letting it go to waste for the time you took looking for an answer. Thanks – blex Nov 25 '14 at 14:11
  • Thank you :-) , hope to help you in another situation. Regards – Ammar Nov 25 '14 at 14:12