这是indexloc提供的服务,不要输入任何密码
Skip to content

[webview_flutter] on Android, soft keyboard always lowercased on textarea and contenteditable #62205

@cooliopas

Description

@cooliopas

On textarea and ContentEditable elements, keyboard should be automatically uppercased for first char on sentences.

This fails even adding autocapitalize="on" to the elements.

Using webview_flutter: ^0.3.22+1

flutter doctor -v

$ flutter doctor -v
[✓] Flutter (Channel beta, 1.20.0-7.2.pre, on Mac OS X 10.14.4 18E226, locale en-AR)
• Flutter version 1.20.0-7.2.pre at /Users/coolio/flutter
• Framework revision a2bde82 (6 days ago), 2020-07-18 15:16:35 -0700
• Engine revision 60b269d898
• Dart version 2.9.0 (build 2.9.0-21.2.beta)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/coolio/Library/Android/sdk
• Platform android-30, build-tools 28.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.3, Build version 11C29
• CocoaPods version 1.9.1

[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 47.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.47.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.12.2

[✓] Connected device (3 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 7.1.1 (API 25) (emulator)
• iPhone SE (13.3) (mobile) • 75CDC5EE-54F3-451E-9675-F9B34BC833CE • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)
• iPhone 8 (mobile) • 36CB0589-4091-4907-9590-9DDA919F0A4E • ios • com.apple.CoreSimulator.SimRuntime.iOS-12-4 (simulator)

• No issues found!

Steps to Reproduce

Run this main.dart:

import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

void main() => runApp(MaterialApp(home: WebViewExample()));

const String kInitialHTML = '''
<!DOCTYPE html><html>
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no" /></head>
<body>
<h2 style="text-align: center;">Textarea</h2>
<textarea autocapitalize="on" style="display: block; width: 90%; height: 200px; margin: 0 auto; padding: 10px; font-size: 20px;"></textarea>
<h2 style="text-align: center;">ContentEditable</h2>
<div autocapitalize="on" style="width: 90%; height: 200px; margin: 0 auto; padding: 10px; font-size: 20px; border: 1px solid black;" contenteditable="true"></div>
</body>
</html>
''';

class WebViewExample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('WebView test')),
      body: Builder(builder: (BuildContext context) {
        return WebView(
          initialUrl: 'data:text/html;base64,${base64Encode(const Utf8Encoder().convert(kInitialHTML))}',
        );
      }),
    );
  }
}

Working as expected on iOS (12.4)
Simulator Screen Shot - iPhone 8 - 2020-07-24 at 12 00 08

NOT Working as expected on Android SDK 25
Screenshot_1595602909

Metadata

Metadata

Assignees

No one assigned

    Labels

    e: device-specificOnly manifests on certain devicesfound in release: 1.20Found to occur in 1.20has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: webviewThe WebView pluginp: webview-keyboardKeyboard issues with flutter_webview pluginpackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyplatform-views: vdIssues specific to the Android VirtualDisplay platform views backendr: 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