Repository navigation
Shift-Digit Shortcuts are broken on macOS #90167
Copy link
Copy link
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsc: regressionIt was better in the past than it is nowIt was better in the past than it is nowfound in release: 2.5Found to occur in 2.5Found to occur in 2.5found in release: 2.6Found to occur in 2.6Found to occur in 2.6frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onteam-macosOwned by the macOS platform teamOwned by the macOS platform teamwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
Description
Shift Keyboard Key not detected
A while ago, almost all keyboard shortcuts in our app stopped working. Now, I investigated it and realized that shift is completely broken.
That is, any shortcuts that use shift do not work. That applies both to SingleActivator as well as LogicalKeySet; LogicalKeyboardKey.shift simply seems to be broken. This happens to our users on Chrome using any device (Windows laptop, Macbook, w/e).
SingleActivator(
LogicalKeyboardKey.keyA,
)Is detected but:
SingleActivator(
LogicalKeyboardKey.keyA,
shift: true,
)is not detected. All the other modifiers still work.
Steps to Reproduce
- Run
flutter create bug --platforms=web. - Update
main.dartas follows:
Click to expand code snippet
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Shift is broken',
shortcuts: const {
SingleActivator(
LogicalKeyboardKey.keyA,
control: true,
): PrintIntent(false),
SingleActivator(
LogicalKeyboardKey.keyA,
shift: true,
): PrintIntent(true),
},
actions: {
PrintIntent: CallbackAction<PrintIntent>(onInvoke: (intent) {
if (intent.shift) {
// This is never called.
print('Shift is working');
return;
}
print('Control is working.');
}),
},
builder: (context, child) {
return const Focus(
autofocus: true,
child: Placeholder(),
);
},
);
}
}
class PrintIntent extends Intent {
const PrintIntent(this.shift);
final bool shift;
}- Run
cd bugandflutter run -d chrome. - Focus the window.
- Press CTRL + A.
- Press SHIFT + A.
Expected results: Control is working. and then Shift is working.
Actual results: Control is working. only.
Logs
Performing hot restart...
Waiting for connection from debug service on Chrome...
Restarted application in 374ms.
Control is working.
Control is working.
Control is working.
[✓] Flutter (Channel dev, 2.6.0-5.1.pre, on Microsoft Windows [Version 10.0.19042.1165], locale en-150)
• Flutter version 2.6.0-5.1.pre
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f2903d3da5 (7 days ago), 2021-09-08 12:44:29 -0700
• Engine revision 0bd9be379a
• Dart version 2.15.0 (build 2.15.0-82.0.dev)
[✓] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[✓] Connected device (3 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 93.0.4577.82
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsc: regressionIt was better in the past than it is nowIt was better in the past than it is nowfound in release: 2.5Found to occur in 2.5Found to occur in 2.5found in release: 2.6Found to occur in 2.6Found to occur in 2.6frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onteam-macosOwned by the macOS platform teamOwned by the macOS platform teamwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
Type
Projects
- StatusShow more project fieldsDone
Activity
maheshj01 commentedon Sep 16, 2021
Hi @creativecreatorormaybenot, Thanks for filing the issue. I am able to replicate the issue on the latest stable
2.5.0as well as the latestmaster 2.6.0-6.0.pre.114. Shift shortcuts work perfectly fine on the older version (stable 2.2.3) this can be verified with the below code sample.It seems like this is a regression probably introduced in #80756
For the code sample below which looks for keybindings
ctrl+Norshift+NThe keybinding
shift+Nworks if N is pressed first followed by shift. But this doesn't work for the above example which usesSingleActivatorcode sample
flutter doctor -v
creativecreatorormaybenot commentedon Sep 16, 2021
Thanks - this seems like a very serious issue to me.
@maheshmnj I also realized now: the behavior seems to be different on Macbook and Windows - on Windows,
shiftdoes not work at all and on Macbook, thealtmodifier (option key) does not work at all either.I also have no workaround for this, i.e. I am not sure how to make our shortcuts work at all right now (I thought I could use another modifier, but that is not the case). I cannot use the
controlmodifier because there are too many actions bound to that already.creativecreatorormaybenot commentedon Sep 16, 2021
@maheshmnj should I create a separate issue for the "Option (or Alt) ⌥" key?
HansMuller commentedon Sep 16, 2021
CC @justinmc @LongCatIsLooong
LongCatIsLooong commentedon Sep 16, 2021
@dkwingsmt it looks like when Shift is pressed the logical key reported for A is
0x00000041and we're expecting0x00000061(flutter run -d linux):justinmc commentedon Sep 16, 2021
I took a quick look at tracking down the PR that caused this, but to me it looks like it was something before both #78522 and #80756. I was able to reproduce the bug on the commit before eb73516 from #78522.
Also just to note, the built-in shortcuts related to shift in DefaultTextEditingShortcuts still work fine for whatever reason.
maheshj01 commentedon Sep 17, 2021
Yes, if the issue is reproducible. Please file that as a separate issue.
23 remaining items
flutter-triage-bot commentedon Aug 17, 2023
This issue was assigned to @dkwingsmt but has had no status updates in a long time. To remove any ambiguity about whether the issue is being worked on, the assignee was removed.
dkwingsmt commentedon Aug 24, 2023
The Web part should have been fixed with flutter-team-archive/engine#34625, Nov 2022. This issue should have been fixed. If anyone has encountered this issue lately, feel free to reply or open a new issue with
flutter doctor --verbose.github-actions commentedon Sep 14, 2023
Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now.
If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones.
Thanks for your contribution.
github-actions commentedon Sep 28, 2023
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 -vand a minimal reproduction of the issue.