Skip to content

In a TextField HOME and END keys do not work on platform Windows #76121

Closed

Description

@rydmike

Steps to Reproduce

When pressing physical keyboard keys HOME or END in a TextField on platform Windows, the cursor does not move anywhere.

Consider this example

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Text Edit',
      home: _TextFieldExample(),
    );
  }
}

class _TextFieldExample extends StatefulWidget {
  @override
  _TextFieldExampleState createState() => _TextFieldExampleState();
}

class _TextFieldExampleState extends State<_TextFieldExample> {
  final FocusNode _focusNode = FocusNode();
  final TextEditingController _textController = TextEditingController();

  @override
  void dispose() {
    _focusNode.dispose();
    _textController.dispose();
    super.dispose();
  }

  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Text Test'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            SizedBox(
              width: 400,
              child: TextField(
                controller: _textController,
                focusNode: _focusNode,
                decoration: InputDecoration(
                  hintText: 'Write something, then press HOME and END key',
                  border: const OutlineInputBorder(),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Expected results

  • HOME pressed -> Expect: Cursor moves to first char position when there is some text in the field.
  • END pressed -> Expect: Cursor moves to last char position when there is some text in the field.

Actual results

  • HOME pressed -> Actual: Cursor does not move anywhere.
  • END pressed -> Actual: Cursor does not move anywhere.

Tested on

Platform WINDOWS
Channel master, 1.27.0-2.0.pre.103 : FAIL
Channel dev, 1.27.0-1.0.pre : FAIL

Platform WEB
Channel master, 1.27.0-2.0.pre.103 : OK
Channel dev, 1.27.0-1.0.pre : OK
Channel beta, 1.26.0-17.5.pre: OK

Works OK on Web, but FAILS on Windows.

This issue should also be tested on platforms macOS and Linux to ensure it does not appear on them as well.
EDIT:
Based on Twitter feedback it works OK on macOS: https://twitter.com/tomgilder/status/1361730262791557121?s=20


Disclaimer

Platform Windows is not ready and only on dev channel (alpha), but as it moves closer to being more ready, issues like these will eventually need to be resolved.

Flutter DOCTOR

[√] Flutter (Channel master, 1.27.0-2.0.pre.103, on Microsoft Windows [Version 10.0.19041.804], locale en-US)
    • Flutter version 1.27.0-2.0.pre.103 at C:\Users\mryds\fvm\versions\master
    • Framework revision f49956598b (10 hours ago), 2021-02-16 00:56:06 -0500
    • Engine revision 1d537824d6
    • Dart version 2.13.0 (build 2.13.0-30.0.dev)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at C:\Users\mryds\AppData\Local\Android\sdk
    • Platform android-30, build-tools 29.0.2
    • Java binary at: C:\Program Files\Android\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:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.8.3)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.8.30804.86
    • Windows 10 SDK version 10.0.18362.0

[√] Android Studio (version 4.1.0)
    • Android Studio at C:\Program Files\Android\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)

[√] IntelliJ IDEA Community Edition (version 2020.3)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.3.1
    • Flutter plugin version 53.1.5
    • Dart plugin version 203.6912

[√] VS Code (version 1.53.2)
    • VS Code at C:\Users\mryds\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.19.0

[√] Connected device (5 available)
    • Nexus 7 (mobile)  • 0a99f5e8    • android-arm    • Android 6.0.1 (API 23)
    • SM T510 (mobile)  • R52N906MLAV • android-arm    • Android 10 (API 29)
    • Windows (desktop) • windows     • windows-x64    • Microsoft Windows [Version 10.0.19041.804]
    • Chrome (web)      • chrome      • web-javascript • Google Chrome 88.0.4324.150
    • Edge (web)        • edge        • web-javascript • Microsoft Edge 88.0.705.68

• No issues found!

Activity

  1. rydmike commented on Feb 16, 2021

    @rydmike
    ContributorAuthor

    Might be related to #75270 and #44918 as well as to this regression #75675.

  2. added
    a: text inputEntering text in a text field or keyboard related problems
    frameworkflutter/packages/flutter repository. See also f: labels.
    platform-windowsBuilding on or for Windows specifically
    on Feb 16, 2021
  3. HansMuller commented on Feb 16, 2021

    @HansMuller
    Contributor
  4. dkwingsmt commented on Feb 16, 2021

    @dkwingsmt
    Contributor

    This requires #44918 but will not be resolved only by it. We might need a separate project for textfield related shortcuts.

  5. added
    P2Important issues not at the top of the work list
    on Feb 18, 2021
  6. TahaTesser commented on Feb 19, 2021

    @TahaTesser
    Contributor

    Hi @rydmike
    This might be specific to windows, I can see no issue on Linux desktop, just reproduced on Windows

    flutter doctor -v
    [✓] Flutter (Channel dev, 1.27.0-4.0.pre, on Microsoft Windows [Version 10.0.19042.804], locale en-US)
        • Flutter version 1.27.0-4.0.pre at C:\Users\Taha\Code\flutter_dev
        • Framework revision f8cd24de95 (3 days ago), 2021-02-16 11:24:17 -0800
        • Engine revision 1d537824d6
        • Dart version 2.13.0 (build 2.13.0-30.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.8.5)
        • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
        • Visual Studio Community 2019 version 16.8.31005.135
        • 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.53.2)
        • VS Code at C:\Users\Taha\AppData\Local\Programs\Microsoft VS Code
        • Flutter extension version 3.19.0
    
    [✓] Connected device (4 available)
        • Android SDK built for x86 (mobile) • emulator-5554 • android-x86    • Android 8.0.0 (API 26) (emulator)
        • Windows (desktop)                  • windows       • windows-x64    • Microsoft Windows [Version 10.0.19042.804]
        • Chrome (web)                       • chrome        • web-javascript • Google Chrome 88.0.4324.182
        • Edge (web)                         • edge          • web-javascript • Microsoft Edge 88.0.705.68
    
    • No issues found!
    [✓] Flutter (Channel master, 1.27.0-5.0.pre.72, on Microsoft Windows [Version 10.0.19042.804], locale en-US)
        • Flutter version 1.27.0-5.0.pre.72 at C:\Users\Taha\Code\flutter_master
        • Framework revision bb3e64dae6 (3 hours ago), 2021-02-19 00:36:03 -0500
        • Engine revision c217d9d06e
        • Dart version 2.13.0 (build 2.13.0-46.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.8.5)
        • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
        • Visual Studio Community 2019 version 16.8.31005.135
        • 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.53.2)
        • VS Code at C:\Users\Taha\AppData\Local\Programs\Microsoft VS Code
        • Flutter extension version 3.19.0
    
    [✓] Connected device (3 available)
        • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19042.804]
        • Chrome (web)      • chrome  • web-javascript • Google Chrome 88.0.4324.182
        • Edge (web)        • edge    • web-javascript • Microsoft Edge 88.0.705.68
    
    • No issues found!

    Thanks for filing the issue

  7. justinmc commented on Feb 22, 2021

    @justinmc
    Contributor

    @dkwingsmt This may be fixed by #75032. Shortcuts seems to pick up home/end keys correctly. I didn't try it on a Windows machine, but it worked on a Mac.

  8. rydmike commented on Feb 23, 2021

    @rydmike
    ContributorAuthor

    Issue #75675 (comment) mentions that its issue was a regression and that it used to work on version 1.26.0-1.0.pre.

    Just to make sure that this does not also apply to this issue, I tested this issue with version 1.26.0-1.0.pre as well. The issue was still present there, so at least this issue is not a regression from version 1.26.0-1.0.pre.


    I also just now re-tested this issue with latest master Channel master, 1.27.0-5.0.pre.114 the issue is STILL present on it as well.


    Above test on Windows platform only, which based on other reports seems to be the only platform with this issue.

  9. dkwingsmt commented on Feb 23, 2021

    @dkwingsmt
    Contributor

    @justinmc Awesome!

  10. dkwingsmt commented on Feb 23, 2021

    @dkwingsmt
    Contributor

    @rydmike Yes, because #75032 is not merged yet. Thanks for confirming though.

  11. rydmike commented on Feb 23, 2021

    @rydmike
    ContributorAuthor

    @dkwingsmt thx, yes I see that now, I did not check if it was merged already. hehe.
    I'll track the PR and test again when it is merged.

  12. PavelPZ commented on Mar 4, 2021

    @PavelPZ

    The following shortcuts are missing too: Ctrl+End, Ctrl+Home, Ctrl+Shift+End, Ctrl+Shift+Home, Shift+End, Shift+Home
    See #77020.

  13. github-actions commented on Aug 4, 2021

    @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.

  14. locked as resolved and limited conversation to collaborators on Aug 4, 2021
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: 1.27Found to occur in 1.27frameworkflutter/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 specifically

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions