Skip to content

[Web] RawKeyboardListener does not return correct data #35347

@mjeffw

Description

@mjeffw

Steps to Reproduce

Gist of code to reproduce the problem:
https://gist.github.com/mjeffw/8f3f57d23b596fde3c1a8dac93a64549

  1. Create a flutter web app with a TextField wrapped by a RawKeyboardListener
  2. In the onKey callback, check for a specific key using the following code: if (value.logicalKey == LogicalKeyboardKey.keyA) print('A');
  3. Run the web app and type the expected key. It never matches.

If I print the logicalKey value of the RawKeyEvent, and type the letter 'A', here is the output:

dart_sdk.js:18740 LogicalKeyboardKey#00039(keyId: "0x00000039", keyLabel: "9", debugName: "Digit 9")
dart_sdk.js:18740 LogicalKeyboardKey#f1dc1(keyId: "0x1000c018a", keyLabel: null, debugName: "Launch Mail")
dart_sdk.js:18740 LogicalKeyboardKey#f1dc1(keyId: "0x1000c018a", keyLabel: null, debugName: "Launch Mail")
dart_sdk.js:18740 LogicalKeyboardKey#00039(keyId: "0x00000039", keyLabel: "9", debugName: "Digit 9")

Logs

Jeffs-MacBook-Pro-2:flutter_web_rawkeyboardlistener_example jeff$ webdev serve --verbose
[INFO] Connecting to the build daemon...
[INFO] Generating build script...
[INFO] Generating build script completed, took 401ms
[INFO] 
[INFO] Starting daemon...
[INFO]BuildDefinition: Initializing inputs
[INFO]BuildDefinition: Reading cached asset graph...
[WARNING]BuildDefinition: Throwing away cached asset graph due to Dart SDK update.
[INFO]BuildDefinition: Cleaning up outputs from previous builds....
[INFO]BuildDefinition: Cleaning up outputs from previous builds. completed, took 136ms

[INFO] Generating build script...
[INFO] Generating build script completed, took 109ms
[INFO] 
[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 12.4s
[INFO] 
[INFO] Starting daemon...
[INFO]BuildDefinition: Initializing inputs
[INFO]BuildDefinition: Building new asset graph...
[INFO]BuildDefinition: Building new asset graph completed, took 1.5s

[INFO]BuildDefinition: Checking for unexpected pre-existing outputs....
[INFO]BuildDefinition: Checking for unexpected pre-existing outputs. completed, took 2ms

[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 1.5s
[INFO] 
[INFO] Checking for unexpected pre-existing outputs....
[INFO] Checking for unexpected pre-existing outputs. completed, took 2ms
[INFO] 
[INFO] Setting up file watchers...
[INFO] Setting up file watchers completed, took 4ms
[INFO] 
[INFO] Registering build targets...
[INFO] Starting initial build...
[INFO] Starting resource servers...
[INFO] Serving `web` on http://127.0.0.1:8080

[INFO] About to build [web]...
[INFO]Build: Running build...
[INFO]Heartbeat: 1.0s elapsed, 89/108 actions completed.
[INFO]Heartbeat: 2.0s elapsed, 285/303 actions completed.
[INFO]Heartbeat: 3.1s elapsed, 517/537 actions completed.
[INFO]Heartbeat: 4.2s elapsed, 694/726 actions completed.
[INFO]Heartbeat: 5.3s elapsed, 694/726 actions completed.
[INFO]Heartbeat: 6.4s elapsed, 705/741 actions completed.
[INFO]Heartbeat: 7.4s elapsed, 716/750 actions completed.
[INFO]Heartbeat: 8.5s elapsed, 720/752 actions completed.
[INFO]Heartbeat: 9.5s elapsed, 722/752 actions completed.
[INFO]Heartbeat: 10.6s elapsed, 726/754 actions completed.
[INFO]Heartbeat: 11.6s elapsed, 731/754 actions completed.
[INFO]Heartbeat: 12.7s elapsed, 734/754 actions completed.
[INFO]Heartbeat: 13.8s elapsed, 737/754 actions completed.
[INFO]Heartbeat: 14.8s elapsed, 739/754 actions completed.
[INFO]Heartbeat: 15.8s elapsed, 740/754 actions completed.
[INFO]Heartbeat: 16.9s elapsed, 740/754 actions completed.
[INFO]Heartbeat: 17.9s elapsed, 742/754 actions completed.
[INFO]Heartbeat: 18.9s elapsed, 743/754 actions completed.
[INFO]Heartbeat: 20.0s elapsed, 744/754 actions completed.
[INFO]Heartbeat: 21.0s elapsed, 745/754 actions completed.
[INFO]Heartbeat: 22.1s elapsed, 748/754 actions completed.
[INFO]Heartbeat: 23.1s elapsed, 750/754 actions completed.
[INFO]Heartbeat: 24.2s elapsed, 750/754 actions completed.
[INFO]Heartbeat: 25.3s elapsed, 752/754 actions completed.
[INFO]Heartbeat: 26.3s elapsed, 752/754 actions completed.
[INFO]Heartbeat: 27.4s elapsed, 752/754 actions completed.
[INFO]Heartbeat: 28.4s elapsed, 752/754 actions completed.
[INFO]Heartbeat: 29.5s elapsed, 752/754 actions completed.
[INFO]Heartbeat: 30.5s elapsed, 754/754 actions completed.
[INFO]Build: Running build completed, took 30.9s

[INFO]Build: Caching finalized dependency graph...
[INFO]Build: Caching finalized dependency graph completed, took 197ms

[INFO]Build: Succeeded after 31.1s with 560 outputs (3266 actions)

[INFO] ----------------------------------------------------------------------------------------------------------------------------------------------------------------

[INFO] About to build [web]...
[INFO]Build: Updating asset graph...
[INFO]Build: Updating asset graph completed, took 12ms

[INFO]Build: Running build...
[INFO]Build: Running build completed, took 359ms

[INFO]Build: Caching finalized dependency graph...
[INFO]Build: Caching finalized dependency graph completed, took 242ms

[INFO]Build: Succeeded after 652ms with 9 outputs (7 actions)

[INFO] ----------------------------------------------------------------------------------------------------------------------------------------------------------------

flutter analyze
Analyzing flutter_web_rawkeyboardlistener_example...                    
No issues found! (ran in 2.8s)
Jeffs-MacBook-Pro-2:flutter_web_rawkeyboardlistener_example jeff$ flutter doctor -v
[✓] Flutter (Channel stable, v1.5.4-hotfix.2, on Mac OS X 10.14.5 18F132, locale en-US)
    • Flutter version 1.5.4-hotfix.2 at /Users/jeff/Projects/git/flutter
    • Framework revision 7a4c33425d (9 weeks ago), 2019-04-29 11:05:24 -0700
    • Engine revision 52c7a1e849
    • Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/jeff/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.2.1, Build version 10E1001
    • ios-deploy 1.9.4
    • CocoaPods version 1.6.1

[✓] Android Studio (version 3.4)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 35.3.1
    • Dart plugin version 183.6270
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[✓] IntelliJ IDEA Community Edition (version 2018.3.5)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 33.4.2
    • Dart plugin version 183.5912.23

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

[!] Connected device
    ! No devices available

! Doctor found issues in 1 category.

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: contributor-productivityTeam-specific productivity, code health, technical debt.c: tech-debtTechnical debt, code quality, testing, etc.frameworkflutter/packages/flutter repository. See also f: labels.platform-webWeb applications specificallyteam-webOwned by Web platform teamteam: skip-testAn issue used to track tests that are skipped.triaged-webTriaged by Web platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions