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

[webview_flutter] Keyboard suggestions can be lost #37989

Open
mklim opened this issue Aug 9, 2019 · 1 comment

Comments

@mklim
Copy link
Member

@mklim mklim commented Aug 9, 2019

To reproduce:

  1. Run webview_flutter/example v0.3.11+2 on an Android device using a soft keyboard that normally provides suggestions based on what's been previously typed in a text field.
  2. Tap into a text field. Observe that the soft keyboard is shown as expected.
  3. Enter text. Observe text is correctly entered.
  4. Minimize keyboard using the Android back button.
  5. Tap back into the same text field. Observe that keyboard is shown again as expected.

Expected: Keyboard should display suggestions related to the text field.
Actual: Keyboard does not display anything related to the current text.

This is related to flutter/plugins#1965. InputEvents are being incorrectly handled by WebView after WebView is resized. This could be an underlying issue in Chromium. We should try to reproduce with a non-Flutter app and file a Chromium bug if possible.

@hisaichi5518

This comment has been minimized.

Copy link

@hisaichi5518 hisaichi5518 commented Nov 20, 2019

By doing the following, it no longer reproduces in my project.

  1. Open android/app/src/main/AndroidManifest.xml
  2. Change the "adjustSize" of "android:windowSoftInputMode" to "adjustPan"
  3. build
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index ab0b9ab..3312c03 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -18,7 +18,7 @@
             android:theme="@style/LaunchTheme"
             android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|den
             android:hardwareAccelerated="true"
-            android:windowSoftInputMode="adjustResize">
+            android:windowSoftInputMode="adjustPan">
             <!-- This keeps the window background of the activity showing
                  until Flutter renders its first frame. It can be removed if
                  there is no splash screen (such as the default splash screen

Cons

  • All Flutter screens are affected by this change
  • Cannot scroll to the bottom when the keyboard is displayed

See also

https://developer.android.com/guide/topics/manifest/activity-element.html#wsoft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.