The big pitfall in the api of browser and keyboard is there is not a method to get the status (keys pressed) of the keyboard.
I know that it is about security stuff, but for the games in js is a bad situation when the canvas lost the focus and the keys pressed change.