flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
166.38k stars 27.56k forks source link

[Web] RawKeyUpEvent is not triggered when both control and mouse click occurs simultaneously on macOS #93778

Open Sangeetha-Raju opened 3 years ago

Sangeetha-Raju commented 3 years ago

Steps to reproduce

  1. Run flutter create bug.
  2. Update your main with the following code.
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() {
  runApp(
    MaterialApp(
      home: MyWidget(),
    ),
  );

   RawKeyboard.instance.addListener((event) {
    final isKeyDown = event is RawKeyDownEvent;
    final key = event.logicalKey.keyLabel;

    print('$isKeyDown - $key - ${event.runtimeType}');
  });
}

class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Text(
          'Build some widgets!',
          style: Theme.of(context).textTheme.headline4,
        ),
      ),
    );
  }
}
  1. flutter run -d chrome
  2. When chrome opens, press and hold control key, then tap the text using mouse. Now, release the control key.

Expected Result:

Screenshot 2021-11-17 at 4 56 24 PM

Actual Result:

Screenshot 2021-11-17 at 4 54 01 PM

verbose log

flutter doctor -v
[✓] Flutter (Channel stable, 2.5.1, on macOS 11.5.1 20G80 darwin-x64, locale
    en-GB)
    • Flutter version 2.5.1 at /Users/syncfusion/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ffb2ecea52 (9 weeks ago), 2021-09-17 15:26:33 -0400
    • Engine revision b3af521a05
    • Dart version 2.14.2

[✓] Android toolchain - develop for Android devices (Android SDK version
    30.0.3)
    • Android SDK at /Users/syncfusion/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = /Users/syncfusion/Library/Android/sdk
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.10.1

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

[✓] Android Studio (version 2020.3)
    • 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 11.0.10+0-b96-7281165)

[✓] Android Studio (version 4.2)
    • Android Studio at
      /usr/local/Caskroom/android-studio/4.2.0.24,202.7322048/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 11.0.8+10-b944.6916264)

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

[✓] Connected device (3 available)
    • iPhone 12 Pro (mobile) • D043B1C6-8314-494C-AEB9-BF6ADEE269A6 • ios
      • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • macOS (desktop)        • macos                                •
      darwin-x64     • macOS 11.5.1 20G80 darwin-x64
    • Chrome (web)           • chrome                               •
      web-javascript • Google Chrome 95.0.4638.69

• No issues found!
maheshj01 commented 3 years ago

Hi @Sangeetha-Raju, Thanks for filing the issue. If I understand correctly when mouse and ctrl key is pressed simultaneously the KeyUpEvent is not getting triggered when the control key is released, is that correct?

Thanks

Sangeetha-Raju commented 3 years ago

Hi @maheshmnj , Yes, you are correct. This issue occurs only when releasing the control key.

maheshj01 commented 3 years ago

@Sangeetha-Raju Thanks for the confirmation, I can reproduce the issue, when mouse left and ctrl key is pressed simultaneously the KeyUpEvent is not getting triggered when the control key is released.

This is probably happening because on pressing mouse left and ctrl, a menu is shown.

flutter doctor -v ``` [✓] Flutter (Channel stable, 2.5.3, on macOS 12.0.1 21A559 darwin-arm, locale en-GB) • Flutter version 2.5.3 at /Users/mahesh/Documents/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 18116933e7 (5 weeks ago), 2021-10-15 10:46:35 -0700 • Engine revision d3ea636dc5 • Dart version 2.14.4 [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/mahesh/Library/Android/sdk • Platform android-31, build-tools 31.0.0 • ANDROID_HOME = /Users/mahesh/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 13.1, Build version 13A1030d • CocoaPods version 1.10.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 4.2) • 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 11.0.8+10-b944.6916264) [✓] IntelliJ IDEA Community Edition (version 2021.2.1) • IntelliJ at /Applications/IntelliJ IDEA CE.app • Flutter plugin version 60.1.4 • Dart plugin version 212.5080.8 [✓] VS Code (version 1.61.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.28.0 [✓] Connected device (3 available) • iPhone 12 (mobile) • 19EA5268-C931-4C3A-ACC6-71D3E849C450 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 12.0.1 21A559 darwin-arm • Chrome (web) • chrome • web-javascript • Google Chrome 96.0.4664.45 • No issues found! ``` ``` [✓] Flutter (Channel master, 2.6.0-12.0.pre.719, on macOS 12.0.1 21A559 darwin-arm, locale en-GB) • Flutter version 2.6.0-12.0.pre.719 at /Users/mahesh/Documents/flutter_master • Upstream repository https://github.com/flutter/flutter.git • Framework revision 34dbee66de (3 days ago), 2021-11-14 18:46:02 -0500 • Engine revision 140bd9399e • Dart version 2.16.0 (build 2.16.0-10.0.dev) • DevTools version 2.8.0 [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/mahesh/Library/Android/sdk • Platform android-31, build-tools 31.0.0 • ANDROID_HOME = /Users/mahesh/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 13.1) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.10.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 4.2) • 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 11.0.8+10-b944.6916264) [✓] IntelliJ IDEA Community Edition (version 2021.2.1) • IntelliJ at /Applications/IntelliJ IDEA CE.app • Flutter plugin version 60.1.4 • Dart plugin version 212.5080.8 [✓] VS Code (version 1.61.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.28.0 [✓] Connected device (3 available) • iPhone 12 (mobile) • 19EA5268-C931-4C3A-ACC6-71D3E849C450 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 12.0.1 21A559 darwin-arm • Chrome (web) • chrome • web-javascript • Google Chrome 96.0.4664.45 • No issues found! ```
logs ``` true - Control Left - RawKeyDownEvent false - Control Left - RawKeyUpEvent true - Control Left - RawKeyDownEvent false - Control Left - RawKeyUpEvent true - Control Left - RawKeyDownEvent false - Control Left - RawKeyUpEvent true - S - RawKeyDownEvent false - S - RawKeyUpEvent true - D - RawKeyDownEvent false - D - RawKeyUpEvent true - F - RawKeyDownEvent false - F - RawKeyUpEvent true - Control Left - RawKeyDownEvent ```
yjbanov commented 3 years ago

/cc @dkwingsmt