I don't think this is a bug, as
NugMan says Firefox just decides to transfer keyboard focus to the button instead of the game. To switch back you just have to click in the canvas. It doesn't happen in Chrome, but the behavior in Firefox is probably a reason to use sprites instead of button objects.