11

I have an application which contains a WebView. Inside it is a div with contenteditable=true.

Suppose I have some text already in the div. When I first click on the text, the cursor pops up and so does the soft keyboard. The problem is that if I click again, the soft keyboard disappears and then reappears.

Technically it isn't a problem since I can still write and do everything I need, but it is quite annoying to have the keyboard pop down and back up every time I want to click something.

I think the problem is coming from the WebView getting a focus event every time I click inside it, but I am unsure if this is the case.

Can someone enlighten me as to what is happening, or at least point me to some resources that can help me?

NickLH
  • 2,643
  • 17
  • 28
  • "if I click again, the soft keyboard disappears and then reappears" do you mean when you click on the text or the back key? Does the soft keyboard disappear permanently when you click the back key? – ılǝ Oct 22 '12 at 02:16
  • Ok, so I "solved" part of the problem using the suggestion here http://stackoverflow.com/questions/10522727/android-soft-keyboard-will-hide-for-no-reason. However, this is slightly problematic as I do want to interact via calling loadUrl(). The other problem is that if the text is focused, and I click the return key on the keyboard, it hides (not wanted behaviour). But if I scroll the view before pressing return, a newline is created and the keyboard stays (desired behaviour). I don't know how to deal with this... – NickLH Oct 22 '12 at 03:15
  • I can recover the keyboard by re-clicking the webview, but it's annoying that it keeps disappearing. – NickLH Oct 22 '12 at 03:18
  • I know this is an old question, but I'm just hitting exactly the same problem on ICS (works on JellyBean). Did you ever figure it out? – pinoyyid Mar 28 '14 at 18:03
  • This issue looks like it can solve your problem: http://stackoverflow.com/questions/8474386/uiwebview-with-contenteditable-html-editing-first-responder-handling – cenk ebret Apr 04 '14 at 08:52

1 Answers1

0

I tried it myself but there was the problem as you described. I think you must have done something to override the tap function, so that it retrace the keyboard and again find that the focus is on editable content so it give keyboard again, That's the best I could think of

Hope This Helps