HTML5: clicking outside canvas with KeyDown

Monkey Forums/Monkey Bug Reports/HTML5: clicking outside canvas with KeyDown

DruggedBunny(Posted 2013) [#1]
Run this for HTML5, keep a cursor key held down and click outside the canvas, then release the cursor key -- the app continues as if the key is held down.

After clicking in the canvas again (try it while the square is still visible!), further input is received but the key remains permanently "held down".

I've tried in Chrome and Firefox...

Import mojo

Function Main ()
    New Game
End

Class Game Extends App

    Field x:Float
    Field y:Float

    Method OnCreate ()

        SetUpdateRate 60

    End

    Method OnUpdate ()

        If KeyDown (KEY_LEFT) Then x = x - 4
        If KeyDown (KEY_RIGHT) Then x = x + 4
        If KeyDown (KEY_UP) Then y = y - 4
        If KeyDown (KEY_DOWN) Then y = y + 4

    End

    Method OnRender ()

        Cls 64, 96, 128
        DrawRect x, y, 32, 32

    End

End