Question

When I "add to homescreen" the http://kato.im webapp on iOS 7 (iPhone 4s), I observe the following behavior when I tap on the textarea input field:

  • Keyboard shows up (as expected)
  • Focus disappears from text area (not expected)

This behavior does not happen on regular, not home-screened webapp.

Is there are workaround to fix this issue?

Was it helpful?

Solution 2

Here's the Knockout Binding Handler that I ended up writing for this:

ko.bindingHandlers.touchFocusTextbox = {
    init: function (element) {
        element.addEventListener("touchstart", function (event) {
            event.stopPropagation();
            event.preventDefault();
            element.focus();
        }, false);
    }
};

And this is how the markup looks to use it:

<input type="text" data-bind="touchFocusTextbox:1">

OTHER TIPS

I facing exactly the same issue, not only in standalone apps, but also in webview. i cant find any reason, or solution.

I got one temporary workaround for this. I bind a touch event into the textarea/input, and force it to focus by using jquery focus(). so far this is working on me.

function focus_textArea(ID){
    $("#"+ID).focus();
}

Hope it help.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top