ionic-team / ionic-plugin-keyboard

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

Weird scroll height on specific settings #169

Open gabrielmuresan opened 8 years ago

gabrielmuresan commented 8 years ago

steps:

  1. <preference name="KeyboardDisplayRequiresUserAction" value="false"/> in config.xml
  2. app.js from a default tabs project one single line changed.
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false);
  1. view template:
<ion-view view-title="Dashboard">
  <ion-content class="padding">
    <label class="item item-input">
      <span class="input-label">Username</span>
      <input type="text" class="search">
    </label>
  </ion-content>
</ion-view>
  1. controller:
.controller('DashCtrl', function($scope) {
  $scope.$on('$ionicView.enter', function() {
      //makes the content go under header
      document.querySelector('.search').focus();
      //works only on Android and WP.
      cordova.plugins.Keyboard.show();
  });
})
  1. run with livereload (bug present in both livereload and no livereload)
  2. start editing controllers.js and save (app livereload kicks in)
  3. watch keyboard open, close keyboard by pressing outside the keyboard on empty space, select manually the input (input goes under the header) also the scroll has height 0;

visualization:

ezgif com-video-to-gif 2

workaround: Add a timeout of minimum 1035 or 1040 and everything is fine.

Any ideas?

Only happens on iOS. Android has no issue with this code.

UPDATE: In the app that I am working with it seems that if the page with the input is on a secondary page (not main page) the bug is not present.