Skip to content

[webview_flutter] Unable to focus on text input in webview  #132143

@fondoger

Description

@fondoger

Is there an existing issue for this?

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_android to 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_android to 3.8.2

I believe the bug was introduced two weeks ago in this PR: flutter/packages#4533
image

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions