Repository navigation
fix(keyboard): listen on correct events for keyboard lifecycle - #27569
Merged
Merged
Conversation
|
|
liamdebeasi
marked this pull request as ready for review
May 30, 2023 13:54
liamdebeasi
requested review from
a team and
sean-perkins
and removed request for
a team
May 30, 2023 21:10
sean-perkins
approved these changes
May 31, 2023
1 of 2 tasks
liamdebeasi
added a commit
that referenced
this pull request
Jun 15, 2023
…able but the Keyboard plugin is not (#27655) Issue number: resolves #27654 --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> When Capacitor and the Keyboard plugin are available, `Keyboard.getEngine()` returns an object: https://github.com/ionic-team/ionic-framework/blob/d3232dcc007738fae851660bd818c8056b48b7d2/core/src/utils/native/keyboard.ts#L19 When Capacitor is _not_ available this method returns `undefined`. However, when Capacitor is available but the Keyboard plugin is not, `Keyboard.getEngine()` returns `false`. In #27569 I fixed a bug where the wrong listeners were being used to emit keyboard lifecycle events. However, I did not know that method can return `false`, and our tests only account for the `undefined` or defined edge cases. As a result, if you are using Capacitor in an app that is deployed to the browser then the visual viewport Ionic keyboard events never fire. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Visual viewport Ionic keyboard events fire in browser ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue number: resolves #27558
What is the current behavior?
The keyboard lifecycle util was always listening on visual viewport events even when in native environments. The visual viewport API is not reliable due to how the Ionic webview customizes how it resizes. We should only be listening on the native keyboard events in native environments.
ionic-team/capacitor#3730
https://github.com/ionic-team/capacitor-plugins/blob/2e883f39329626062bcf876fe7d424432617229d/keyboard/ios/Plugin/Keyboard.m#L90-L98
What is the new behavior?
Does this introduce a breaking change?
Other information