Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@capacitor/keyboard v6 stopped working for windowSoftInputMode="adjustPan" on older SDKs #2158

Open
chriswep opened this issue Jul 26, 2024 · 3 comments

Comments

@chriswep
Copy link

Bug Report

Keyboard listeners don't fire on Android <= 10 devices when android:windowSoftInputMode="adjustPan" is set. Changing the input mode to adjustResize makes the listeners work again, however we used adjustPan since it allowed us to get the keyboardHeight without the webivew being resized. Looking at the diff (c4f9165) it seems that the implmentation was basically replaced completely. Something about the new implmentation made it stop working for the adjustPan mode on older Android sdks.

What is working:

  • Android 10 + downgrading to v5 of capacitor-keyboard
  • soft input mode adjustPan on newer Android devices (tested on Android 14)
  • soft input mode adjustResize

Plugin(s)

@capacitor/keyboard

Capacitor Version

6

Platform(s)

Android

Current Behavior

No keyboard events are dispatched when android:windowSoftInputMode="adjustPan" is set on the activity on older SDKs. Tested on SDK 29 Emulator and Android 10 real device. Android 14 does work with "adjustPan": keyboard events are dispatched, including correct keyboardHeight.

Expected Behavior

Keyboard events are dispatched when using "adjustPan" and older (supported) devices - like it did with V5.

Code Reproduction

Set android:windowSoftInputMode="adjustPan" on the main activity and test with an SDK 29 emulator. No keyboard events are dispatched.

@Ionitron
Copy link
Collaborator

This issue needs more information before it can be addressed.
In particular, the reporter needs to provide a minimal sample app that demonstrates the issue.
If no sample app is provided within 15 days, the issue will be closed.

Please see the Contributing Guide for how to create a Sample App.

Thanks!
Ionitron 💙

@chriswep
Copy link
Author

here you go: https://github.com/chriswep/cap6-keyboard-adjustpan-android10

  • npm install
  • npm build
  • npx cap sync
  • npx cap open android
  • run the app in SDK >= 31 emulator (30 not tested)
  • open JS console
  • click on input field
  • see log for captured willShow event
  • run the app in SDK 29 emulator
  • open JS console
  • click on input field
  • event not captured

@chriswep
Copy link
Author

if you want you can downgrade the keyboard plugin to v5 and see that the event will be captured on both SDKs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants