ionic-team / ionic-plugin-keyboard

Ionic Keyboard Plugin for Cordova
Apache License 2.0
610 stars 274 forks source link

(IOS) How to stop native.keyboardhide event from firing when focusing an input element? #173

Open vandervidi opened 8 years ago

vandervidi commented 8 years ago

In IOS, When i tap and focus an input element the native.keyboardshow event fires and the keyboard pops up. This is absolutely fine. Then,while the keyboard is up, When tapping another input element and focusing it for some reason the native.keyboardhide event fires and then the native.keyboardshow fires. Why does it happen in IOS? and how can i prevent this behaviour so that when one input is focused and the keyboard is up --> focusing another input element would not trigger the native.keyboardhide event??

ramonornela commented 8 years ago

+1

slorber commented 8 years ago

You can probably use _.debounce for that (but it may add a little latency to the code you run in the listener)

keenan35i commented 8 years ago

Here is an easy workaround:

var checker = true;

function keyboardShowHandler(e) {
    checker = true;
}

function keyboardHideHandler(e) {
    checker = false;
    setTimeout(function() {
        if (checker == false) {
            // do stuff when acually closed
        }
    }, 30);
}