Repository navigation
[webview_flutter] Unable to focus on text input in webview #132143
Description
Is there an existing issue for this?
- I have searched the existing package issues
- I have read the guide to filing a bug
What package does this bug report belong to?
webview_flutter
What target platforms are you seeing this bug on?
Android
Have you already upgraded your packages?
Yes
Dependency versions
pubspec.lock
No provided. Please see the screenshot.
Steps to reproduce
Steps to reproduce issue:
- Upgrade
webview_flutter_androidto 3.9.2
Important: I can only reproduce the issue on Android device in Release mode. I tested debug mode, the issue does not show. I think the showing of keyboard somehow caused the flutter app to re-render the webview.
Steps I used to fix the bug:
- Downgrade
webview_flutter_androidto 3.8.2
I believe the bug was introduced two weeks ago in this PR: flutter/packages#4533

Please revert that PR until some one come up with a better solution.
Expected results
Expected Behavior: When I tap to focus on a <input> element in webview, the soft keyboard shows and I can type normally.
expected.mp4
Actual results
Wrong behavior: When I tap to focus on a <input> element in webview, the page flashes with white screen, and automatically loose focus. The soft keyboard cannot open and I cannot type.
notexpected.mp4
Code sample
Code sample
No provided. Please see the videos I uploaded.Screenshots or Videos
Screenshots / Video demonstration
Expected Behavior: When I tap to focus on a <input> element in webview, the soft keyboard shows and I can type normally.
expected.mp4
Wrong behavior: When I tap to focus on a <input> element in webview, the page flashes with white screen, and automatically loose focus. The soft keyboard cannot open and I cannot type.
notexpected.mp4
Logs
Logs
No related logs.Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.10.6, on macOS 13.4.1 22F770820d darwin-x64, locale en-CN)
• Flutter version 3.10.6 on channel stable at /Users/fondoger/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f468f3366c (4 weeks ago), 2023-07-12 15:19:05 -0700
• Engine revision cdbeda788a
• Dart version 3.0.6
• DevTools version 2.23.1
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
• Android SDK at /Users/fondoger/Library/Android/sdk
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14E300c
• CocoaPods version 1.12.0
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
[✓] VS Code (version 1.80.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.70.0
[✓] Connected device (3 available)
• V2055A (mobile) • 192.168.0.100:42651 • android-arm64 • Android 12 (API 31)
• macOS (desktop) • macos • darwin-x64 • macOS 13.4.1 22F770820d darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 115.0.5790.170
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 1 category.
Activity
darshankawar commentedon Aug 9, 2023
Thanks for the report @fondoger
I tried the plugin example and ran in release mode but was able to input and type in properly and it also showed up the keyboard properly as below:
I used latest plugin versions. If above doesn't represent your case, can you provide us a minimal code sample so that we can make the issue actionable ?
JDongKhan commentedon Aug 9, 2023
Help, same issue was found in my app with few android devices.
JDongKhan commentedon Aug 9, 2023
webview_flutter_android: 3.8.2is work for me.It seems to have occurred during the first installation.
JDongKhan commentedon Aug 9, 2023
1、install and open the app
https://github.com/flutter/flutter/assets/4929805/6e7a4749-a44d-4795-8edf-87cd3670ef67
2、kill the app and then open it
https://github.com/flutter/flutter/assets/4929805/51988a7c-fe98-445e-b6c2-267ea8808980
darshankawar commentedon Aug 9, 2023
I tried by using
<input type="text">in plugin example, ran in release mode in which the keyboard opened properly:[webview_flutter_android][webview_flutter_wkwebview] Fixes widget reb…
github-actions commentedon Aug 24, 2023
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.[webview_flutter_android][webview_flutter_wkwebview] Fixes widget reb…
[webview_flutter_android][webview_flutter_wkwebview] Fixes widget reb…
[webview_flutter_android][webview_flutter_wkwebview] Fixes widget reb…