Skip to content

[Android] TextField cursor doesn't move to tapped position, but converts into text selection mode after selecting input mode from virtual keyboard. #98720

Description

@nero-angela

UPDATE: For current status, see #98720 (comment) and thereafter.

.

.

Original report follows.


I found an issue with TextField, I'm not sure if it's intended or not.
After entering text in the TextField, if you select the text in the middle, the cursor should move to that position.
However, if you add two exclamation marks after the text and select the middle of the text, the cursor does not move to that location, but selects up to that location.

This issue was found in both English and Korean.

Steps to Reproduce

  1. Enter arbitrary strings in the TextField.
  2. Finally, enter two exclamation marks.
  3. Click in the middle of the text.
  4. Instead of moving the cursor to that position, it is selected from the back to the selected point.
XRecorder_18022022_120747.mp4
Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: const [
            Padding(
              padding: EdgeInsets.all(8.0),
              child: TextField(),
            ),
          ],
        ),
      ),
    );
  }
}
flutter doctor -v
[✓] Flutter (Channel unknown, 2.11.0-0.0.pre.542, on macOS 12.0.1 21A559 darwin-x64, locale ko-KR)
    • Flutter version 2.11.0-0.0.pre.542 at /Users/nero/Project/FlutterContribution/flutter
    • Upstream repository unknown
    • Framework revision 1958656943 (4 days ago), 2022-02-14 05:15:17 -0500
    • Engine revision b63614c306
    • Dart version 2.17.0 (build 2.17.0-104.0.dev)
    • DevTools version 2.10.0

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/nero/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Volumes/Lecture HD/Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 44.0.2
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] Android Studio (version 2020.3)
    • Android Studio at /Volumes/Lecture HD/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.10+0-b96-7281165)

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

[✓] VS Code (version 1.63.2)
    • VS Code at /Volumes/Lecture HD/Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.34.0

[✓] Connected device (3 available)
    • SM G950N (mobile)  • ce0317136a2c08f10c                   • android-arm64  • Android 9 (API 28)
    • iPhone 13 (mobile) • 2A06E0D7-FBAB-4FBD-AFA9-34FB720E1B61 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-2
      (simulator)
    • Chrome (web)       • chrome                               • web-javascript • Google Chrome 98.0.4758.102

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemse: device-specificOnly manifests on certain devicese: samsungIssues only reproducible on Samsung devicesf: material designflutter/packages/flutter/material repository.f: selectionSelectableRegion, SelectionArea, SelectionContainer, Selectable, and related APIsfound in release: 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyteam-text-inputOwned by Text Input teamtriaged-text-inputTriaged by Text Input team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions