Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyboard shortcuts stop working when caps lock is down. #79374

Closed
TahaTesser opened this issue Mar 30, 2021 · 15 comments
Closed

Keyboard shortcuts stop working when caps lock is down. #79374

TahaTesser opened this issue Mar 30, 2021 · 15 comments
Assignees
Labels
a: desktop Running on desktop a: text input Entering text in a text field or keyboard related problems f: material design flutter/packages/flutter/material repository. found in release: 2.1 Found to occur in 2.1 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list platform-mac Building on or for macOS specifically r: fixed Issue is closed as already fixed in a newer version

Comments

@TahaTesser
Copy link
Member

TahaTesser commented Mar 30, 2021

Steps to reproduce

  1. Creat a project on any of the latest channels
  2. Add a TextField()
    or try the code sample below
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(),
      ),
      floatingActionButton: FloatingActionButton(
        child: Icon(Icons.add),
        onPressed: () {},
      ),
    );
  }
}

Actual Results

Be able to enter only capital text and delete the text with backspace/delete

Expected Results

Not able to delete text with backspace/delete when text is in caps in the end

Note:

  1. If you enter lower caps text right after all caps text, you will be able to delete text backspace/delete
  2. If you enter only lower caps, there is no issue
  3. It reproduces all channels (check multiple doctor -v below) on the macOS Desktop app
When there is only capital text
ezgif com-gif-maker (9)
Backspace/delete only working where there non-captial text at the end
ezgif com-gif-maker (8)

Screenshot 2021-03-30 at 5 21 58 PM

flutter doctor -v
[✓] Flutter (Channel stable, 2.0.3, on macOS 11.2.3 20D91 darwin-x64, locale
    en-GB)
    • Flutter version 2.0.3 at /Users/tahatesser/Code/flutter_stable
    • Framework revision 4d7946a68d (12 days ago), 2021-03-18 17:24:33 -0700
    • Engine revision 3459eb2436
    • Dart version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Volumes/Extreme/SDK
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = /Volumes/Extreme/SDK
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

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

[✓] Android Studio (version 4.1)
    • 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
      1.8.0_242-release-1644-b3-6915495)

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

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 11.2.3 20D91 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 89.0.4389.90

• No issues found!
[✓] Flutter (Channel beta, 2.1.0-12.2.pre, on macOS 11.2.3 20D91 darwin-x64,
    locale en-GB)
    • Flutter version 2.1.0-12.2.pre at /Users/tahatesser/Code/flutter_beta
    • Framework revision 5bedb7b1d5 (13 days ago), 2021-03-17 17:06:30 -0700
    • Engine revision 711ab3fda0
    • Dart version 2.13.0 (build 2.13.0-116.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Volumes/Extreme/SDK
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = /Volumes/Extreme/SDK
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

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

[✓] Android Studio (version 4.1)
    • 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
      1.8.0_242-release-1644-b3-6915495)

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

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 11.2.3 20D91 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 89.0.4389.90

• No issues found!
[✓] Flutter (Channel dev, 2.1.0-12.1.pre, on macOS 11.2.3 20D91 darwin-x64,
    locale en-GB)
    • Flutter version 2.1.0-12.1.pre at /Users/tahatesser/Code/flutter_dev
    • Framework revision 8264cb3e8a (3 weeks ago), 2021-03-10 12:37:57 -0800
    • Engine revision 711ab3fda0
    • Dart version 2.13.0 (build 2.13.0-116.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Volumes/Extreme/SDK
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = /Volumes/Extreme/SDK
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

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

[✓] Android Studio (version 4.1)
    • 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
      1.8.0_242-release-1644-b3-6915495)

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

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 11.2.3 20D91 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 89.0.4389.90

• No issues found!
[✓] Flutter (Channel master, 2.1.0-13.0.pre.323, on macOS 11.2.3 20D91
    darwin-x64, locale en-GB)
    • Flutter version 2.1.0-13.0.pre.323 at
      /Users/tahatesser/Code/flutter_master
    • Framework revision 2cdd51900c (6 hours ago), 2021-03-30 10:16:05 +0200
    • Engine revision dbcbf69a57
    • Dart version 2.13.0 (build 2.13.0-175.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Volumes/Extreme/SDK
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = /Volumes/Extreme/SDK
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

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

[✓] Android Studio (version 4.1)
    • 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
      1.8.0_242-release-1644-b3-6915495)

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

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 11.2.3 20D91 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 89.0.4389.90

• No issues found!
@HansMuller HansMuller added a: text input Entering text in a text field or keyboard related problems f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Mar 30, 2021
@HansMuller
Copy link
Contributor

CC @justinmc

@justinmc
Copy link
Contributor

I can't reproduce this on the latest master using the same version of Big Sur with the code above. I start the app, type "FFFFFF", and press delete, and it deletes like normal. Am I following the steps correctly?

Strange bug though, I'm not sure what would cause this.

@TahaTesser
Copy link
Member Author

TahaTesser commented Mar 30, 2021

@justinmc
Just tried an on-screen keyboard to demonstrate my key-stroke pattern (I was using the physical keyboard before), with it even lower case text isn't being deleted. While the text in Chrome deletes fine

Screen.Recording.2021-03-30.at.7.17.56.PM.mov

@darshankawar darshankawar added the in triage Presently being triaged by the triage team label Mar 31, 2021
@darshankawar
Copy link
Member

darshankawar commented Mar 31, 2021

I wasn't able to replicate this issue using physical keyboard as mentioned in issue description, but only by following below pattern that involves onscreen keyboard.

  1. When TextField is focussed and we use physical keyboard to enter lower case and upper case letters, the letters are deleted, as expected:
79374_w_ph_keyb.mov
  1. If we open onscreen keyboard that has a default input source (ex: ABC or ABC extended) and type in lower case letters, then those letters are deleted as expected, but as soon as we turn ON caps lock and type in a letter, then those are not getting deleted. Moreover, if we turn OFF caps lock and now enter lower case letters, now these are also not getting deleted:
79373_w_onscreen_keyb.mov
  1. Now if we switch to physical keyboard and try to enter any lower case or upper case letter, none is deleted:
79374_again_p_keyb.mov

Looking at step 2 above, if we are coming back from onscreen keyboard to physical keyboard, then regular letters in small caps or upper case letters are not getting deleted, so this issue isn't limited to not deleting last upper case letter, but if the last letter is small caps, the same issue persists.

flutter doctor -v
[✓] Flutter (Channel master, 2.1.0-13.0.pre.346, on Mac OS X 10.15.4 19E2269
    darwin-x64, locale en-GB)
    • Flutter version 2.1.0-13.0.pre.346 at
      /Users/dhs/documents/Fluttersdk/flutter
    • Framework revision 8158b478d7 (2 hours ago), 2021-03-31 13:29:03 +0800
    • Engine revision dbcbf69a57
    • Dart version 2.13.0 (build 2.13.0-175.0.dev)

[!] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.3, Build version 12C33
    ! CocoaPods 1.9.3 out of date (1.10.0 is recommended).
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin
        code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To upgrade see
      https://guides.cocoapods.org/using/getting-started.html#installation for
      instructions.

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

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

[✓] Connected device (4 available)
    • Darshan's iphone (mobile)  • 21150b119064aecc249dfcfe05e259197461ce23 •
      ios            • iOS 14.4.1
    • iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729     •
      ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
    • macOS (desktop)            • macos                                    •
      darwin-x64     • Mac OS X 10.15.4 19E2269 darwin-x64
    • Chrome (web)               • chrome                                   •
      web-javascript • Google Chrome 89.0.4389.114

! Doctor found issues in 1 category.

@darshankawar darshankawar added a: desktop Running on desktop found in release: 2.1 Found to occur in 2.1 has reproducible steps The issue has been confirmed reproducible and is ready to work on platform-mac Building on or for macOS specifically and removed in triage Presently being triaged by the triage team labels Mar 31, 2021
@darshankawar darshankawar changed the title [macOS] Backspace/Delete stops working when there is capital text at the end in a TextField [macOS] Backspace / delete stops working if we use onscreen keyboard. Issue persists after switching back to physical keyboard. Mar 31, 2021
@TahaTesser
Copy link
Member Author

TahaTesser commented Mar 31, 2021

Originally issue reproduced without using the on-screen keyboard #79374 (comment)

Here is a demonstration of the issue without ever opening the on-screen keyboard [1 min complete preview]

Screen.Recording.2021-03-31.at.1.00.19.PM.mov

Keyboard layout

Screenshot 2021-03-31 at 1 04 34 PM

Note:

The issue also reproduced when using direct MacBook's keyboard as well as when using a magic keyboard, no difference

@darshankawar
Copy link
Member

darshankawar commented Mar 31, 2021

Updated my earlier comment to indicate it was replicable only by using onscreen keyboard + physical keyboard for me.

@gspencergoog
Copy link
Contributor

This is a known issue caused by not tracking the caps lock state separately from the caps lock key press state. This should be fixed by #44918

@gspencergoog gspencergoog changed the title [macOS] Backspace / delete stops working if we use onscreen keyboard. Issue persists after switching back to physical keyboard. Keyboard shortcuts stop working when caps lock is down. Apr 1, 2021
@gspencergoog gspencergoog added P2 Important issues not at the top of the work list and removed platform-mac Building on or for macOS specifically labels Apr 1, 2021
@edwardaux
Copy link
Contributor

Hi all, I originally raised another ticket when I encountered this problem on the mac, but subsequently discovered that this one had already been raised. In my case it was specifically that backspace, delete and cursor arrows just mysteriously stop working when caps-lock is on.

I see that #44918 has been earmarked as the ticket that will fix it, however that ticket has been open for almost 2 years now with no visibility as to when it will be released (which is totally fine... it is a large ticket with a lot of implications so I get that it takes time).

However, the question is what to do about this problem right now. Where we are at the moment is that the app can easily get into a state where important keystrokes are just ignored and there's no clue to the user about why that is happening. I mean, I'm a developer and it took me ages to track down a repeatable case... what hope do my users have of figuring out why the app has suddenly stopped responding?

Is there any chance of a tactical fix or a suggested workaround while we're waiting for 44918 (and/or a bump in the priority)? I get that caps-lock isn't massively used on mobile, but on desktop/web, it is very common. This feels, to me, like a pretty bad bug and to be honest, I'm reluctant to ship a mac app where my app becomes non-responsive just because the user has their caps-lock key on.

@edwardaux
Copy link
Contributor

Actually, there's definitely another underlying problem with the cursor/backspace keys. I've lost count of the number of times I've just suddenly lost the ability to backspace even without caps lock on (it also affects the cursor arrow keys, delete, and the tab key). Normal text entry continues to work fine.

I'm yet to find a reliable way to reproduce, but it happens approx 10 times a day for me (note that this is on macOS... not sure if it happens on mobile too).

Not that I expect anyone from the Flutter team to be able to do anything without a repeatable test case, but I just thought I'd mention it here as a datapoint.

@cbracken
Copy link
Member

cbracken commented Sep 28, 2021

Assigning to @dkwingsmt to ensure this is on his radar.

@dkwingsmt can you confirm whether this issue is still an issue?

@cbracken
Copy link
Member

Tested just now on Win32 and wasn't able to reproduce in the following situations:

  • physical keyboard only
  • on-screen keyboard, using caps-lock and control key combinations on on-screen keyboard
  • physical keyboard with on-screen keyboard up

I'm going to label this as macOS-specific for the moment since it seems like all reports above have been for macOS. I have not yet tested on macOS.

@cbracken cbracken added the platform-mac Building on or for macOS specifically label Oct 18, 2021
@gspencergoog
Copy link
Contributor

I tested this on macOS, and was unable to reproduce it on a Macbook with the system physical keyboard.

Which is not to say that it might not happen intermittently and just didn't happen to me the several times (~20) that I tried it.

@cbracken cbracken removed this from In progress in Win32 Desktop Stable Oct 19, 2021
@cbracken cbracken added this to To do in Desktop Post-stable via automation Oct 19, 2021
@cbracken
Copy link
Member

@dkwingsmt we're punting this to the post-stable project.

@dkwingsmt
Copy link
Contributor

This issue should have been fixed by #80756 (merged on Apr 26, 2021).

@edwardaux I'm sorry to hear about the random hiccups. We have improved a lot since your comment. Let us know if you're experiencing any issues lately.

Desktop Post-stable automation moved this from To do to Done Mar 4, 2022
@darshankawar darshankawar added the r: fixed Issue is closed as already fixed in a newer version label Mar 4, 2022
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: desktop Running on desktop a: text input Entering text in a text field or keyboard related problems f: material design flutter/packages/flutter/material repository. found in release: 2.1 Found to occur in 2.1 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list platform-mac Building on or for macOS specifically r: fixed Issue is closed as already fixed in a newer version
Projects
No open projects
Development

No branches or pull requests

8 participants