ionic-team / ionic-v1

The repo for Ionic 1.x. For the latest version of Ionic, please see https://github.com/ionic-team/ionic
Other
192 stars 187 forks source link

iOS 'keyboard-open' class is re-added to CSS upon hiding keyboard, if the keyboard was auto-openened and manually hidden #313

Open ivinogradov opened 6 years ago

ivinogradov commented 6 years ago

Short description of the problem:

If you have a modal with a <textarea> as the first field, when that modal opens, the field will get the focus automatically, and the keyboard would popup, which is expected. The keyboard-open CSS class would be added to the DOM, which is also expected. However, when you manually hide the keyboard, that class would be removed from CSS and re-added a moment later, while the keyboard remains hidden. This messes us the custom scrolling, dependent on that CSS class.

What behavior are you expecting?

If the keyboard is hidden, there shouldn't be keyboard-open CSS class in the DOM.

Steps to reproduce:

  1. Have a modal with a <textarea>. Disable scrolling of the modal with <ion-content scroll="false">, keep the native scrolling enabled for the ionic-keyboard-plugin, such that the keyboard pushes the modal up.
  2. Add css code that modifies the position of the modal so it's pushed up by the keyboard. E.g. .platform-ipad.special-keyboard-open { margin-top: -50% }
  3. Open the modal in your app, watch the keyboard appear automatically and push the popup up. Dismiss the keyboard. Watch the popup moving down briefly, just to come back to where it was when the keyboard was open.

Other information: The issue doesn't happen when the user manually places focus into the textfield, and then dismisses the keyboard.

Which Ionic Version? Ionic 1 project built with Ionic 2.2.3 Cordova 7.0.1

Plunker that shows an example of your issue

For Ionic 1 issues - http://plnkr.co/edit/Xo1QyAUx35ny1Xf9ODHx?p=preview

For Ionic 2 issues - http://plnkr.co/edit/me3Uk0GKWVRhZWU0usad?p=preview

Run ionic info from terminal/cmd prompt: (paste output below) Cordova CLI: 7.0.1 Ionic CLI Version: 2.2.3 Ionic App Lib Version: 2.2.1 ios-deploy version: 1.9.1 ios-sim version: 5.0.13 OS: macOS Sierra Node Version: v6.10.3 Xcode version: Xcode 8.3.1 Build version 8E1000a