Ivan
Ivan

Reputation: 4234

Dart language arrow keys event

i'm trying to develop a simple application in dart, and i want to catch the arrow keys press event, i tried to add a onKeyPress event:

window.on.keyPress.add(myKeyDownEvent);

void myKeyDownEvent(Event event){
  query("#text").text = event.type.toString();  
}

It works with all keypress except arrow keys what is wrong?

Upvotes: 3

Views: 518

Answers (1)

Alexandre Ardhuin
Alexandre Ardhuin

Reputation: 76213

There's a issue on chrome for that with WontFix status. Comment 5 says :

This is done to match IE. keypress events are only supposed to fire for keys that insert characters. Note that keydown/keyup do fire for arrow keys.

Using window.on.keyDown instead of window.on.keyPress works for me.

Upvotes: 3

Related Questions