Pregunta

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?

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top