Skip to content

Shift-Digit Shortcuts are broken on macOS #90167

@creativecreatorormaybenot

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

  1. Run flutter create bug --platforms=web.
  2. Update main.dart as 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;
}
  1. Run cd bug and flutter run -d chrome.
  2. Focus the window.
  3. Press CTRL + A.
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsc: regressionIt was better in the past than it is nowfound in release: 2.5Found to occur in 2.5found in release: 2.6Found to occur in 2.6frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-macosOwned by the macOS platform teamwaiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter responds

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions