Skip to content

[windows] Pressing Right-Shift turns on caps lock and locks in a TextField #75675

Closed

Description

@ChargerMc

On flutter desktop, Right-Shift turns on caps lock and locks in a TextField

Code excample:

TextField(
              decoration: InputDecoration(
                  alignLabelWithHint: true,
                  labelText: 'Escribe el mensaje...',
                  hintText: '...',
                  labelStyle: TextStyle(
                      fontSize:
                          Theme.of(context).textTheme.headline6.fontSize)),
              maxLines: 8,
              enableInteractiveSelection: true,
              controller: messageController,
              onChanged: (value) {

              },
            ), 

Flutter Doctor:


> Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel dev, 1.26.0-17.1.pre, on Microsoft Windows [Version 10.0.19042.746], locale es-MX)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.8.4)   
[√] Android Studio (version 4.0)
[√] VS Code (version 1.53.0)
[√] Connected device (3 available)

• No issues found!

Activity

  1. TahaTesser commented on Feb 9, 2021

    @TahaTesser
    Contributor

    Hi @ChargerMc
    Thanks for filing the issue, I can reproduce it on Windows (not on macOS), the right-shift key is acting as CAPS lock on the dev and master

    code sample
    import 'package:flutter/material.dart';
    
    void main() => runApp(MyApp());
    
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Material App',
          theme: ThemeData.dark(),
          home: Home(),
        );
      }
    }
    
    class Home extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            title: Text('Material App Bar'),
          ),
          body: Center(
            child: TextField(
              decoration: InputDecoration(
                  alignLabelWithHint: true,
                  labelText: 'Escribe el mensaje...',
                  hintText: '...',
                  labelStyle: TextStyle(
                      fontSize: Theme.of(context).textTheme.headline6.fontSize)),
              maxLines: 8,
              enableInteractiveSelection: true,
              onChanged: (value) {},
            ),
          ),
          floatingActionButton: FloatingActionButton(
            child: Icon(Icons.add),
            onPressed: () {},
          ),
        );
      }
    }
    
    flutter doctor -v
    [√] Flutter (Channel dev, 1.26.0-17.2.pre, on Microsoft Windows [Version 10.0.19042.746], locale en-US)
        • Flutter version 1.26.0-17.2.pre at C:\Users\Taha\Code\flutter_dev
        • Framework revision 79b49b9e10 (5 days ago), 2021-02-03 15:33:39 -0800
        • Engine revision 2c527d6c7e
        • Dart version 2.12.0 (build 2.12.0-259.8.beta)
    [√] 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:\Program Files\Google\Chrome\Application\chrome.exe
    [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.8.4)
        • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
        • Visual Studio Community 2019 version 16.8.30907.101
        • 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.0)
        • 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.746]
        • Chrome (web)      • chrome  • web-javascript • Google Chrome 88.0.4324.150
        • Edge (web)        • edge    • web-javascript • Microsoft Edge 88.0.705.63
    • No issues found!
    [√] Flutter (Channel master, 1.26.0-18.0.pre.215, on Microsoft Windows [Version 10.0.19042.746], locale en-US)
        • Flutter version 1.26.0-18.0.pre.215 at C:\Users\Taha\Code\flutter_master
        • Framework revision f3c10bd23a (3 hours ago), 2021-02-08 21:52:03 -0800
        • Engine revision b04955656c
        • Dart version 2.13.0 (build 2.13.0-0.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:\Program Files\Google\Chrome\Application\chrome.exe
    [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.8.4)
        • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
        • Visual Studio Community 2019 version 16.8.30907.101
        • 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.0)
        • 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.746]
        • Chrome (web)      • chrome  • web-javascript • Google Chrome 88.0.4324.150
        • Edge (web)        • edge    • web-javascript • Microsoft Edge 88.0.705.63
    • No issues found!

    Thank you

  2. changed the title [-][Flutter Desktop] Textfield bloq mayus when pressing right shift.[/-] [+][windows] Pressing Right-Shift turns on caps lock and locks in a TextField[/+] on Feb 9, 2021
  3. added
    a: text inputEntering text in a text field or keyboard related problems
    engineflutter/engine related. See also e: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    platform-windowsBuilding on or for Windows specifically
    on Feb 9, 2021
  4. ChargerMc commented on Feb 9, 2021

    @ChargerMc
    Author

    Hi @ChargerMc
    Thanks for filing the issue, I can reproduce it on Windows (not on macOS), the right-shift key is acting as CAPS lock on the dev and master

    code sample

    import 'package:flutter/material.dart';
    
    void main() => runApp(MyApp());
    
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Material App',
          theme: ThemeData.dark(),
          home: Home(),
        );
      }
    }
    
    class Home extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            title: Text('Material App Bar'),
          ),
          body: Center(
            child: TextField(
              decoration: InputDecoration(
                  alignLabelWithHint: true,
                  labelText: 'Escribe el mensaje...',
                  hintText: '...',
                  labelStyle: TextStyle(
                      fontSize: Theme.of(context).textTheme.headline6.fontSize)),
              maxLines: 8,
              enableInteractiveSelection: true,
              onChanged: (value) {},
            ),
          ),
          floatingActionButton: FloatingActionButton(
            child: Icon(Icons.add),
            onPressed: () {},
          ),
        );
      }
    }

    flutter doctor -v
    Thank you

    Great, thank u!

  5. nekomaruh commented on Feb 9, 2021

    @nekomaruh

    There is a similar issue in macos. For example when you write CAPITAL LETTERS, you cannot delete the Text if the String ends with a capital one. This happens when using textfield or cupertinotextfield and seems to be a Flutter binding library problem.

    Im still waiting for the team to solve this issue since 4 months ago.

  6. added
    p: webview-keyboardKeyboard issues with flutter_webview plugin
    and removed on Feb 9, 2021
  7. 33 remaining items

  8. Coimbra1984 commented on May 4, 2021

    @Coimbra1984

    During testing the above (which works), I reached to a horrible defect. I have a German keyboard, to make a @ sign we have to press ALT-GR+Q key. When I do this, something happens which makes windows completely confused. I'm unable to enter anything after that even in other programs, I need to restart my PC. We tested this behaviour on two different machines, against the flutter stable, beta and dev channel. All show the same problem. Is this part of this defect here, or must I open a new one for that?

  9. dkwingsmt commented on May 4, 2021

    @dkwingsmt
    Contributor

    @ChargerMc @Coimbra1984 Neither of your problems is not part of this issue (which I feel bad to hear). Can you check if there are existing issues, and if not, open a new one with reproduction step? Thank you.

  10. dkwingsmt commented on May 4, 2021

    @dkwingsmt
    Contributor

    @Coimbra1984 The AltGr issue is probably #78005.

  11. dkwingsmt commented on May 4, 2021

    @dkwingsmt
    Contributor

    @cbracken Is the "holá" issue a known one?

  12. ChargerMc commented on May 4, 2021

    @ChargerMc
    Author

    @cbracken Is the "holá" issue a known one?

    Yes, there's a issue: #75510

  13. gerryhigh commented on May 4, 2021

    @gerryhigh

    flutter/engine#25882 should have fixed this issue. Please wait until the engine is rolled into the framework, or wait until the next version.
    Since this is a widespread issue I'm gonna leave this issue open until confirmed by many. In the mean time, you might workaround this issue by wrapping the root of the app with the following widget:

    class ShiftRightFixer extends StatefulWidget {
      ShiftRightFixer({this.child});
      final Widget child;
      @override
      State<StatefulWidget> createState() => _ShiftRightFixerState();
    }
    
    class _ShiftRightFixerState extends State<ShiftRightFixer> {
      final FocusNode focus = FocusNode(skipTraversal: true, canRequestFocus: false);
      @override
      Widget build(BuildContext context) {
        return Focus(
          focusNode: focus,
          onKey: (_, RawKeyEvent event) {
            return event.physicalKey == PhysicalKeyboardKey.shiftRight ?
              KeyEventResult.handled : KeyEventResult.ignored;
          },
          child: widget.child,
        );
      }
    }

    Also, my deep apology for leaving this issue for so long and causing widespread inconvenience. Although I have been working on the keyboard system full time, in retrospect this issue could have been resolved earlier. There are both the complexity of the issue as well as the misjudgement on my side. I'll take the blame, but please know that we're reading all the reports and care about experience of Flutter on all platforms.

    This fix worked for me--I wrapped my login screen class in this to fix login issues. Thanks!

  14. gutisalex commented on May 5, 2021

    @gutisalex

    flutter/engine#25882 should have fixed this issue. Please wait until the engine is rolled into the framework, or wait until the next version.
    Since this is a widespread issue I'm gonna leave this issue open until confirmed by many. In the mean time, you might workaround this issue by wrapping the root of the app with the following widget:

    class ShiftRightFixer extends StatefulWidget {
      ShiftRightFixer({this.child});
      final Widget child;
      @override
      State<StatefulWidget> createState() => _ShiftRightFixerState();
    }
    
    class _ShiftRightFixerState extends State<ShiftRightFixer> {
      final FocusNode focus = FocusNode(skipTraversal: true, canRequestFocus: false);
      @override
      Widget build(BuildContext context) {
        return Focus(
          focusNode: focus,
          onKey: (_, RawKeyEvent event) {
            return event.physicalKey == PhysicalKeyboardKey.shiftRight ?
              KeyEventResult.handled : KeyEventResult.ignored;
          },
          child: widget.child,
        );
      }
    }

    Also, my deep apology for leaving this issue for so long and causing widespread inconvenience. Although I have been working on the keyboard system full time, in retrospect this issue could have been resolved earlier. There are both the complexity of the issue as well as the misjudgement on my side. I'll take the blame, but please know that we're reading all the reports and care about experience of Flutter on all platforms.

    thanks that worked...

  15. RobertLemmens commented on May 23, 2021

    @RobertLemmens

    flutter/engine#25882 should have fixed this issue. Please wait until the engine is rolled into the framework, or wait until the next version.
    Since this is a widespread issue I'm gonna leave this issue open until confirmed by many. In the mean time, you might workaround this issue by wrapping the root of the app with the following widget:

    class ShiftRightFixer extends StatefulWidget {
      ShiftRightFixer({this.child});
      final Widget child;
      @override
      State<StatefulWidget> createState() => _ShiftRightFixerState();
    }
    
    class _ShiftRightFixerState extends State<ShiftRightFixer> {
      final FocusNode focus = FocusNode(skipTraversal: true, canRequestFocus: false);
      @override
      Widget build(BuildContext context) {
        return Focus(
          focusNode: focus,
          onKey: (_, RawKeyEvent event) {
            return event.physicalKey == PhysicalKeyboardKey.shiftRight ?
              KeyEventResult.handled : KeyEventResult.ignored;
          },
          child: widget.child,
        );
      }
    }

    Also, my deep apology for leaving this issue for so long and causing widespread inconvenience. Although I have been working on the keyboard system full time, in retrospect this issue could have been resolved earlier. There are both the complexity of the issue as well as the misjudgement on my side. I'll take the blame, but please know that we're reading all the reports and care about experience of Flutter on all platforms.

    thanks, this worked for me aswell.

  16. iampopal commented on May 25, 2021

    @iampopal

    Waiting for a fix for this issue, it's still happening at flutter 2.2 version

  17. zsmiklos commented on Jun 10, 2021

    @zsmiklos

    @imariman have written a quick fix (hack) for this bug at this page: #78005 It works! So I published my first Flutter Windows app with this hack. (Now we are waiting for a permanent fix from Flutter team. But it does not matter now.)

  18. dkwingsmt commented on Jul 13, 2021

    @dkwingsmt
    Contributor

    I'll close this issue for now but feel free comment if there are any related problems, and reopen this issue if deemed necessary (don't forget to append your Flutter version in the report).

    For non-related problems mentioned in this thread, please move forward to their respective issue page (we will fix them for sure).

  19. added
    r: fixedIssue is closed as already fixed in a newer version
    on Jul 29, 2021
  20. github-actions commented on Aug 12, 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.

  21. locked as resolved and limited conversation to collaborators on Aug 12, 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 problemsc: regressionIt was better in the past than it is nowcustomer: crowdAffects or could affect many people, though not necessarily a specific customer.engineflutter/engine related. See also e: labels.found in release: 1.26Found to occur in 1.26found in release: 1.27Found to occur in 1.27has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-windowsBuilding on or for Windows specificallyr: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions