Skip to content

fix(keyboard): keyboard events emit correctly when Capacitor is available but the Keyboard plugin is not - #27655

Merged
liamdebeasi merged 4 commits into
mainfrom
FW-4580
Jun 15, 2023
Merged

liamdebeasi merged 4 commits into
mainfrom
FW-4580

Conversation

@liamdebeasi

@liamdebeasi liamdebeasi commented Jun 15, 2023 •

Copy link
Copy Markdown
Contributor

Issue number: resolves #27654


What is the current behavior?

When Capacitor and the Keyboard plugin are available, Keyboard.getEngine() returns an object:

return (win as any)?.Capacitor?.isPluginAvailable('Keyboard') && (win as any)?.Capacitor.Plugins.Keyboard;

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?

  • Visual viewport Ionic keyboard events fire in browser

Does this introduce a breaking change?

  • Yes
  • No

Other information

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions github-actions Bot added the package: core @ionic/core package label Jun 15, 2023
@liamdebeasi liamdebeasi changed the title Fw 4580 fix(keyboard): keyboard events emit correctly when Capacitor is available but the Keyboard plugin is not Jun 15, 2023
@liamdebeasi
liamdebeasi marked this pull request as ready for review June 15, 2023 15:24

@thetaPC thetaPC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@liamdebeasi
liamdebeasi added this pull request to the merge queue Jun 15, 2023
Merged via the queue into main with commit 7a38a00 Jun 15, 2023
@liamdebeasi
liamdebeasi deleted the FW-4580 branch June 15, 2023 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ionKeyboardDidShow and ionKeyboardDidHide browser keyboard events stopped working

3 participants