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

TextEditingController.clear() doesn't clear Korean input with a Samsung Keyboard on Android 10. #71782

Open
njovy opened this issue Dec 5, 2020 · 4 comments
Labels
a: text input Entering text in a text field or keyboard related problems e: device-specific Only manifests on certain devices engine flutter/engine repository. See also e: labels. framework flutter/packages/flutter repository. See also f: labels. P2 Important issues not at the top of the work list platform-android Android applications specifically team-android Owned by Android platform team triaged-android Triaged by Android platform team

Comments

@njovy
Copy link

njovy commented Dec 5, 2020

Steps to Reproduce

  1. Type Korean letters.
  2. Call TextEditingController.clear()
  3. Repeat the first step.
  4. The input is not cleared.
import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    home: TextFieldDemo(),
  ));
}

class TextFieldDemo extends StatefulWidget {
  @override
  _TextFieldDemoState createState() => _TextFieldDemoState();
}

class _TextFieldDemoState extends State<TextFieldDemo> {
  List<String> messages = [];

  TextEditingController controller = TextEditingController();
  FocusNode focusNode = FocusNode();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          Expanded(
            child: ListView(
              reverse: true,
              children: messages.map((e) => Text(e)).toList(),
            ),
          ),
          TextField(
            textInputAction: TextInputAction.send,
            maxLines: 1,
            keyboardType: TextInputType.text,
            focusNode: focusNode,
            controller: controller,
            autofocus: false,
            onSubmitted: (input) {
              FocusScope.of(context).requestFocus(focusNode);
              onSend(input);
            },
            decoration: InputDecoration(
              border: OutlineInputBorder(),
              contentPadding: EdgeInsets.only(left: 15, right: 15, bottom: 6),
            ),
          ),
          FlatButton(
              minWidth: MediaQuery.of(context).size.width,
              onPressed: () {
                onSend(controller.text);
              },
              child: Text("SEND"))
        ],
      ),
    );
  }

  void onSend(String input) {
    final message = input.trim();
    if (message.isNotEmpty) {
      controller.clear();
      setState(() {
        messages.insert(0, message);
      });
    }
  }
}

@GaryQian

Calling TextEditingController.clear() doesn't clear text in TextField when a user types Korean.

Attached is a minimal code that you can reproduce this bug.

ezgif-2-c9c04d06a571
This GIF demonstrates that clear() clears the English input but it doesn't clear the input with Korean letters. The previous input that was supposed to be cleared remains.

I am mentioning GaryQian because it seems like this issue only appears on Android with a Samsung's Keyboard. The same issue doesn't appear with Gboard.

Even if an expected result is same, the way it appears is not same as #69161 describes so submitting a new issue.

PS: The issue didn't appear on Galaxy S9+ running Android 9 or below. One of my colleagues have tested this bug. Two other different Galaxy devices running Android 10 have this issue so I think this bug is related to OS version specific.

[✓] Flutter (Channel stable, 1.22.4, on Mac OS X 10.15.6 19G2021 darwin-x64, locale en-KR)
    • Flutter version 1.22.4 at /Users/captainpark/Library/Flutter/sdk
    • Framework revision 1aafb3a8b9 (3 weeks ago), 2020-11-13 09:59:28 -0800
    • Engine revision 2c956a31c0
    • Dart version 2.10.4

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/captainpark/Library/Android/sdk
    • Platform android-30, build-tools 29.0.3
    • ANDROID_HOME = /Users/captainpark/Library/Android/sdk
    • 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 12.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0, Build version 12A7209
    • CocoaPods version 1.10.0

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

[✓] IntelliJ IDEA Ultimate Edition (version 2020.3)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin installed
    • Dart plugin version 203.5981.152

[✓] Connected device (3 available)
    • SM G981N (mobile)            • R3CN40AGS3T                              • android-arm64 • Android 10 (API 29)
    • AOSP on IA Emulator (mobile) • emulator-5554                            • android-x86   • Android 9 (API 28) (emulator)
    • iPhone (mobile)              • c22785dc2a6631af0e74c77f6ba687157d613600 • ios           • iOS 10.3.2


@njovy njovy changed the title TextEditingController.clear() doesn't clear Korean input with a Samsung Keyboard on Android. TextEditingController.clear() doesn't clear Korean input with a Samsung Keyboard on Android 10. Dec 6, 2020
@TahaTesser
Copy link
Member

Hi @njovy
Running on Galaxy M30, Android 10, TextEditingController.clear() works every time. Unless i am missing something here?

Preview

ezgif com-gif-maker (2)

code sample
import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    home: TextFieldDemo(),
  ));
}

class TextFieldDemo extends StatefulWidget {
  @override
  _TextFieldDemoState createState() => _TextFieldDemoState();
}

class _TextFieldDemoState extends State<TextFieldDemo> {
  List<String> messages = [];

  TextEditingController controller = TextEditingController();
  FocusNode focusNode = FocusNode();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          Expanded(
            child: ListView(
              reverse: true,
              children: messages.map((e) => Text(e)).toList(),
            ),
          ),
          TextField(
            textInputAction: TextInputAction.send,
            maxLines: 1,
            keyboardType: TextInputType.text,
            focusNode: focusNode,
            controller: controller,
            autofocus: false,
            onSubmitted: (input) {
              FocusScope.of(context).requestFocus(focusNode);
              onSend(input);
            },
            decoration: InputDecoration(
              border: OutlineInputBorder(),
              contentPadding: EdgeInsets.only(left: 15, right: 15, bottom: 6),
            ),
          ),
          FlatButton(
              minWidth: MediaQuery.of(context).size.width,
              onPressed: () {
                onSend(controller.text);
              },
              child: Text("SEND"))
        ],
      ),
    );
  }

  void onSend(String input) {
    final message = input.trim();
    if (message.isNotEmpty) {
      controller.clear();
      setState(() {
        messages.insert(0, message);
      });
    }
  }
}
flutter doctor -v
[✓] Flutter (Channel stable, 1.22.4, on macOS 11.0.1 20B29 darwin-x64, locale
    en-GB)
    • Flutter version 1.22.4 at /Users/tahatesser/Code/flutter_stable
    • Framework revision 1aafb3a8b9 (3 weeks ago), 2020-11-13 09:59:28 -0800
    • Engine revision 2c956a31c0
    • Dart version 2.10.4

 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/tahatesser/Code/sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = /Users/tahatesser/Code/sdk
    • 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-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.2)
    • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer
    • Xcode 12.2, Build version 12B45b
    • CocoaPods version 1.10.0

[!] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6915495)

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

[✓] Connected device (2 available)
    • Taha’s iPad (mobile) • 00008020-000255113EE8402E            • ios • iOS
      14.2
    • iPhone 12 (mobile)   • C303B5A5-D598-4CAC-8ACC-09BF07A191DC • ios •
      com.apple.CoreSimulator.SimRuntime.iOS-14-2 (simulator)

! Doctor found issues in 1 category.

@TahaTesser TahaTesser added in triage Presently being triaged by the triage team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds labels Dec 7, 2020
@njovy
Copy link
Author

njovy commented Dec 7, 2020

@TahaTesser The preview you posted shows that you use the auto suggestion to type. This bug happens due to the way Korean characters are built. It doesn't have to be exact letter as I typed but I believe the auto suggestion clears some flag internally so the bug doesn't appear.
Try to type exact letter as I typed in my preview. ㅇㅏㄴㄴㅕㅇ - tap send button - ㅇ <- this should be enough to see this bug.

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Dec 7, 2020
@TahaTesser
Copy link
Member

Hi @njovy
I tried again without touch suggestions even once, same results, the same device

Preview

https://drive.google.com/file/d/1L5TC4XPc-fjpeQYLb-BFu6_Hef_M4tk5/view?usp=sharing

@TahaTesser TahaTesser added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Dec 8, 2020
@njovy
Copy link
Author

njovy commented Dec 11, 2020

@TahaTesser It could be device specific or locale but three different devices running Android 10 have this issue with the same code.

Galaxy S20
Galaxy Note 10
Galaxy Fold 2

This is a list of devices running Android 10 that has this issue at the moment.
@GaryQian Any comments regarding this issue?

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Dec 11, 2020
@TahaTesser TahaTesser added a: text input Entering text in a text field or keyboard related problems e: device-specific Only manifests on certain devices engine flutter/engine repository. See also e: labels. framework flutter/packages/flutter repository. See also f: labels. passed first triage platform-android Android applications specifically and removed in triage Presently being triaged by the triage team labels Dec 14, 2020
@chinmaygarde chinmaygarde added P2 Important issues not at the top of the work list e: device-specific Only manifests on certain devices and removed e: device-specific Only manifests on certain devices labels Dec 14, 2020
@flutter-triage-bot flutter-triage-bot bot added multiteam-retriage-candidate team-android Owned by Android platform team triaged-android Triaged by Android platform team labels Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: text input Entering text in a text field or keyboard related problems e: device-specific Only manifests on certain devices engine flutter/engine repository. See also e: labels. framework flutter/packages/flutter repository. See also f: labels. P2 Important issues not at the top of the work list platform-android Android applications specifically team-android Owned by Android platform team triaged-android Triaged by Android platform team
Projects
None yet
Development

No branches or pull requests

4 participants