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

onKeyUp event not working #35333

Open
GuillaumeDesforges opened this Issue Dec 6, 2018 · 1 comment

Comments

Projects
None yet
1 participant
@GuillaumeDesforges

GuillaumeDesforges commented Dec 6, 2018

  • Dart SDK Version: 2.1.0
  • Linux Manjaro
  • Chrome with Webstorm Plugin
<!DOCTYPE html>

<html>
<head>
    <meta charset="utf-8">
    <title>front</title>
    <link rel="stylesheet" href="styles.css">
    <script defer src="main.dart.js"></script>
</head>

<body>
<canvas id="canvas" width="800" height="400"></canvas>
</body>
</html>
import 'dart:html';

void main() {
    window.onKeyUp.listen((KeyboardEvent event) {
        print("Key: " + event.keyCode.toString());
    });
}

The code above does not work, as it never prints any key code when I release a key.

If I change onKeyUp to onKeyDown everything is fine though.

@GuillaumeDesforges

This comment has been minimized.

GuillaumeDesforges commented Dec 9, 2018

Fixed using this snippet:

GlobalEventHandlers.keyUpEvent.forTarget(document, useCapture: true).listen((e) {
      print("up");
    });```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment