Sencha touch causes iOS keyboard to disappear right after it appears

179 views Asked by At

We are using sencha touch 2.3.1

Sometimes when clicking on a text field it will bring up the keyboard and then immediately make the keyboard disappear.

This is worse on an iPad mini 1, but still sometimes happens on an iPad mini 2.

We tried preventing the blur event, but our code doesn't seem able to prevent the blur.

We also looked into the autoBlurInput in Ext.viewport.Default, but it still happens even with that set to false.

1

There are 1 answers

0
jc12 On BEST ANSWER

You need to listen to the touchstart event on the component that has the problem and then prevent the touchstart event if the activeElement does not match the target.

Example:

if (Ext.os.is.iOS) {
    this.innerElement.on({
        scope: this,
        touchstart: "onTouchStart"
    });
}

onTouchStart: function (e) {
    if (document.activeElement != e.target) {
        e.preventDefault();
    }
}