ionic-team / ionic-plugin-keyboard

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

iOS 11 keyboardshow event not firing when switching from language to emoji keyboard #298

Open SebastianSchirmer opened 7 years ago

SebastianSchirmer commented 7 years ago

With iOS 11, an issue has popped up which we were not observing with previous iOS versions. There is no keyboardshow event fired anymore when the keyboard is open and its height changes.

The description of when this occurs is identical to the description I gave some time ago in this PR: https://github.com/ionic-team/ionic-plugin-keyboard/pull/204

On iOS it is possible to select different keyboards when writing into form fields. E.g. an English keyboard, a German keyboard, and also the special built-in Emoji keyboard. If a user has enabled "Predictive" in his keyboard settings (Settings --> General --> Keyboard --> Predictive) then there is no issue with the current plugin code. However, if "Predictive" is turned off, a "language" keyboard has a different height than the "emoji" keyboard which is higher. This occurs if switching from one keyboard to another during inputting text. For example, a user starts typing using his English keyboard, then switches to the emoji keyboard to type some emoji. As the emoji keyboard has a different height (higher) than the English one (only if "Predictive" is switched off), the keyboardshow event does not fire at it did with iOS 10 and before.

Here are 2 screen videos illustrating the issue, the first one with option "Predictive" turned on, the second one with option "Predictive" turned off. The second one shows the erroneous behaviour.

1) "Predictive" turned on, correct behaviour

2) "Predictive" turned off, incorrect behaviour

thessler27 commented 7 years ago

this is because that specific behavior is not supported in ionic-plugin-keyboard.... yet. the listener is just for when the keyboard is shown or hidden, not when the keyboard's frame is changed.

that said, I have submitted a PR here that listens for the UIKeyboardDidChangeFrameNotification which tracks specifically for that, and returns the new height at e.keyboardHeight.

evidently, iOS 11 is still being super annoying and not listening well for this when switching between keyboards as well as it should but that should be fixed in upcoming patches, i would assume. this is the correct way of listening for this event.

thessler27 commented 7 years ago

it's also been recorded that this is an apple bug that they know about. so we have this implementation ready and wait for an OS update: http://openradar.appspot.com/radar?id=5026499329523712

SebastianSchirmer commented 7 years ago

That may work, thank you!