Skip to content

Windows word modifier inconsistencies #78572

Open

Description

@justinmc

On Windows, navigating through text with the arrow keys while holding control behaves slightly differently than other platforms, and Flutter misses this. Windows jumps to the start of the next word in either direction, while other platforms jump to the end of words when moving right and the beginning of words when moving left.

Steps to Reproduce

  1. Run the app below on Windows, which is just a TextField with "word word word" in it.
  2. Focus the field and put the cursor at the start.
  3. Hold the word modifier key (ctrl on Windows, option on Mac) and press the right arrow key.

Expected results: "word |word word"

Actual results: "word| word word"

This is the correct behavior on all other platforms, but not on Windows.

Code
import 'package:flutter/material.dart';
 
void main() {
  runApp(MyApp());
}
 
class MyApp extends StatelessWidget {
  final TextEditingController controller = TextEditingController(text: 'word word word');

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: TextField(
            controller: controller,
          ),
        ),
      ),
    );
  }
}

Test on Windows 10 using Notepad.

Activity

  1. added
    a: text inputEntering text in a text field or keyboard related problems
    platform-windowsBuilding on or for Windows specifically
    on Mar 18, 2021
  2. TahaTesser commented on Mar 24, 2021

    @TahaTesser
    Contributor

    I can reproduce the inconsistent behaviour on Windows 10 on the latest master. On Mac, cursor directly jump to the end when pressing command + right arrow

    flutter doctor -v
    [✓] Flutter (Channel master, 2.1.0-13.0.pre.234, on Microsoft Windows [Version 10.0.19042.867], locale en-US)
        • Flutter version 2.1.0-13.0.pre.234 at C:\Users\Taha\Code\flutter_master
        • Framework revision 515ef91ba1 (45 minutes ago), 2021-03-24 04:59:57 -0700
        • Engine revision d59a01d2d3
        • Dart version 2.13.0 (build 2.13.0-150.0.dev)
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
        • Android SDK at C:\Users\Taha\Code\SDK
        • Platform android-30, build-tools 30.0.3
        • ANDROID_HOME = C:\Users\Taha\Code\SDK
        • Java binary at: C:\Users\Taha\Code\android-studio\jre\bin\java
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
        • All Android licenses accepted.
    
    [✓] Chrome - develop for the web
        • Chrome at C:\Users\Taha\AppData\Local\Google\Chrome\Application\chrome.exe
    
    [✓] Visual Studio - develop for Windows (Visual Studio Community 2019 16.9.2)
        • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
        • Visual Studio Community 2019 version 16.9.31112.23
        • Windows 10 SDK version 10.0.18362.0
    
    [✓] Android Studio (version 4.1.0)
        • Android Studio at C:\Users\Taha\Code\android-studio
        • 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 1.8.0_242-release-1644-b01)
    
    [✓] VS Code (version 1.54.3)
        • VS Code at C:\Users\Taha\AppData\Local\Programs\Microsoft VS Code
        • Flutter extension version 3.20.0
    
    [✓] Connected device (3 available)
        • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19042.867]
        • Chrome (web)      • chrome  • web-javascript • Google Chrome 89.0.4389.90
        • Edge (web)        • edge    • web-javascript • Microsoft Edge 89.0.774.45
    
    • No issues found!
  3. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    on Mar 24, 2021
  4. added
    P2Important issues not at the top of the work list
    on May 5, 2022
  5. added
    team-windowsOwned by the Windows platform team
    team-linuxOwned by the Linux platform team
    and removed
    team-linuxOwned by the Linux platform team
    on Jun 6, 2024
  6. flutter-triage-bot commented on Jun 7, 2024

    @flutter-triage-bot

    The triaged-desktop label is irrelevant if there is no team-desktop label or fyi-desktop label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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.1Found to occur in 2.1frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-windowsBuilding on or for Windows specificallyteam-windowsOwned by the Windows platform teamtriaged-windowsTriaged by the Windows platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions