Skip to content

TextField: issues with selection using shift+mouse click on the web #91979

Closed

Description

@ElessarST

Steps to Reproduce

  1. Execute the code sample
  2. Enter text to the text field (e.g. copy paste code sample to it)
  3. Move cursor to the start of the TextField
  4. Hold shift and click on to the end of the word

Expected results:

The word should be selected

Actual results:

The cursor just moved to the new place without selecting the text

Code sample
TextField(
      maxLines: 8,
      decoration: InputDecoration.collapsed(hintText: "Enter your text here"),
    );

Gist - https://dartpad.dev/?id=f47ec8a65b32abbd7646831d65311724&null_safety=true

Logs
 info • Use key in widget constructors • lib/main.dart:9:7 • use_key_in_widget_constructors
 info • Use key in widget constructors • lib/main.dart:26:7 • use_key_in_widget_constructors
flutter doctor -v
[✓] Flutter (Channel stable, 2.5.2, on macOS 11.6 20G165 darwin-x64, locale en)
    • Flutter version 2.5.2 at /Users/aydar/Documents/tools/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 3595343e20 (2 weeks ago), 2021-09-30 12:58:18 -0700
    • Engine revision 6ac856380f
    • Dart version 2.14.3

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc2)
    • Android SDK at /Users/aydar/Library/Android/sdk
    • Platform android-30, build-tools 31.0.0-rc2
    • ANDROID_HOME = /Users/aydar/Library/Android/sdk
    • Java binary at: /Users/aydar/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7784292/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 at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5, Build version 12E262
    • CocoaPods version 1.10.1

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

[✓] Android Studio (version 2020.3)
    • Android Studio at /Users/aydar/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7784292/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)

[✓] Android Studio (version 2020.3)
    • Android Studio at /Users/aydar/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/203.7784292/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.60.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 94.0.4606.81

• No issues found!

Screen.Recording.2021-10-18.at.10.01.45.mov

Activity

  1. danagbemava-nc commented on Oct 18, 2021

    @danagbemava-nc
    Member

    Issue is reproducible on stable and master.

    I can reproduce it in chrome and macOS.

    code sample
    import 'package:flutter/material.dart';
    
    const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
    
    void main() {
      runApp(MyApp());
    }
    
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          theme: ThemeData.dark().copyWith(
            scaffoldBackgroundColor: darkBlue,
          ),
          debugShowCheckedModeBanner: false,
          home: Scaffold(
            body: Center(
              child: MyWidget(),
            ),
          ),
        );
      }
    }
    
    class MyWidget extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return const TextField(
          maxLines: 8,
          decoration: InputDecoration.collapsed(hintText: "Enter your text here"),
        );
      }
    }
    
    flutter doctor -v
    [✓] Flutter (Channel stable, 2.5.3, on macOS 11.6 20G165 darwin-arm, locale en-GB)
        • Flutter version 2.5.3 at /Users/nexus/dev/sdks/flutter
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 18116933e7 (3 days ago), 2021-10-15 10:46:35 -0700
        • Engine revision d3ea636dc5
        • Dart version 2.14.4
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
        • Android SDK at /Users/nexus/Library/Android/sdk
        • Platform android-31, build-tools 31.0.0
        • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 12.5.1, Build version 12E507
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2020.3)
        • 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.10+0-b96-7249189)
    
    [✓] VS Code (version 1.61.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.27.0
    
    [✓] Connected device (2 available)
        • macOS (desktop) • macos  • darwin-arm64   • macOS 11.6 20G165 darwin-arm
        • Chrome (web)    • chrome • web-javascript • Google Chrome 94.0.4606.81
        ! Error: Errors were encountered while preparing your device for development. Please check the Devices and Simulators Window.  (code -1)
    
    • No issues found!
    [✓] Flutter (Channel master, 2.6.0-12.0.pre.379, on macOS 11.6 20G165 darwin-arm, locale en-GB)
        • Flutter version 2.6.0-12.0.pre.379 at /Users/nexus/dev/sdks/flutters
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 93da78f896 (2 days ago), 2021-10-16 07:18:02 -0400
        • Engine revision faa45f497f
        • Dart version 2.15.0 (build 2.15.0-226.0.dev)
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
        • Android SDK at /Users/nexus/Library/Android/sdk
        • Platform android-31, build-tools 31.0.0
        • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
        • All Android licenses accepted.
    
    [!] Xcode - develop for iOS and macOS (Xcode 12.5.1)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        ! Flutter recommends a minimum Xcode version of 13.0.0.
          Download the latest version or update via the Mac App Store.
        • CocoaPods version 1.11.2
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2020.3)
        • 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.10+0-b96-7249189)
    
    [✓] VS Code (version 1.61.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.27.0
    
    [✓] Connected device (2 available)
        • macOS (desktop) • macos  • darwin-arm64   • macOS 11.6 20G165 darwin-arm
        • Chrome (web)    • chrome • web-javascript • Google Chrome 94.0.4606.81
        ! Error: Errors were encountered while preparing your device for development. Please check the Devices and Simulators Window.  (code -1)
    
    ! Doctor found issues in 1 category.
  2. added
    a: text inputEntering text in a text field or keyboard related problems
    p: material_uimaterial_ui package in flutter/packages
    frameworkflutter/packages/flutter repository. See also f: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    platform-macosBuilding on or for macOS specifically
    platform-webWeb applications specifically
    and removed
    in triagePresently being triaged by the triage team
    platform-macosBuilding on or for macOS specifically
    platform-webWeb applications specifically
    on Oct 18, 2021
  3. yjbanov commented on Oct 18, 2021

    @yjbanov
    Contributor
  4. cbracken commented on Oct 18, 2021

    @cbracken
    Member
  5. dkwingsmt commented on Oct 20, 2021

    @dkwingsmt
    Contributor

    Has it ever worked in previous versions? I don't see any code implementing it.

    Nevertheless this is a valid feature.

  6. added
    P2Important issues not at the top of the work list
    on Oct 21, 2021
  7. justinmc commented on Dec 10, 2021

    @justinmc
    Contributor

    In order for this issue to be considered complete, we should also support shift + click + drag. Natively this extends the selection created by the shift + click.

    #93835 will implement shift + tap and I'll follow up with another PR to add the drag.

  8. github-actions commented on Feb 18, 2022

    @github-actions

    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 -v and a minimal reproduction of the issue.

  9. locked as resolved and limited conversation to collaborators on Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: desktopRunning on desktopa: text inputEntering text in a text field or keyboard related problemsfound in release: 2.5Found to occur in 2.5found in release: 2.6Found to occur in 2.6frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packages

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions