Ionic hide-on-keyboard-open not working on Android 4.4


#1

I’m using the hide-on-keyboard-open class with the ionic keyboard plugin. On iOS, any element with the class is hidden when the keyboard is opened. However, on some Android phones (Android 4.4, no fullscreen app), this class has no effect.

I tried to debug the problem and found that:

  • The keyboard-open class is not added to the body when the keyboard opens.
  • If I add the keyboard-open class manually, the elements are hidden.
  • If I add the class manually when the keyboard’s open, and then close the keyboard, the class is correctly removed and the elements are shown.
  • It makes no difference if I open the keyboard by focussing on an input field or manually with cordova.plugins.Keyboard.show().
  • Adding my own event listener to native.keyboardshow works.
  • Mimicking the code from the ionic source to add the class works:
    window.ionic.requestAnimationFrame(function(){ document.body.classList.add('keybord-open'); });

I now applied this fix in my own code, but this is of course not a good solution:

$window.addEventListener('native.keyboardshow', function(){
  document.body.classList.add('keyboard-open');
});

I couldn’t pinpoint the exact problem in the ionic source yet.


#2

I submitted it as a bug to github: https://github.com/driftyco/ionic/issues/3041


#3

215 days old - and jvannistelrooy observations completely fit my situation!

running ionic 1.6.4
cordova 5.0.0

Is there any future for a built in solution rather then listening to the keyboard ourselves?