I have an $ionicPopup.alert, but I don’t want it to pop up when the keyboard is open. I thought I could simply test ionic.keyboard.isOpen but it doesn’t seems to work. I can create my own flag like this and it works fine:

var keyboardIsOpen = false;
window.addEventListener('native.keyboardshow', function keyboardShowHandler(e) {keyboardIsOpen = true;});
window.addEventListener('native.keyboardhide', function keyboardShowHandler(e) {keyboardIsOpen = false;});
    if (!keyboardIsOpen) {        // why not ionic.keyboard.isOpen ?
}, 5000);

Is there a better way to do this?

(I do have the Ionic keyboard plugin loaded obviously, since the event listeners are picking up native.keyboardshow/hide.)


Hmm, can you throw this into a codepen? I can check this out in the morning.


codepen won’t show the popup keyboard, right? Really need to try this on an emulator I think.


Yes, the codepen wouldn’t show a keyboard, but I can take the codepen and throw it into a project for testing :smile:


Okay, please try this codepen: