namuol/cheet.js — pull request #5 by mildmojo (2013-11-27 00:57:37+00:00)
Title: Fix cheat code events bubbling up to the browser

Some keys are used as browser shortcut keys. If these are part of a
sequence, the browser may intercept the key events and take focus away
from the page.

For example, the Firefox accessibility.typeaheadfind feature pops the
search box open when any letter/number key is pressed. This makes
entering a cheat code impossible, since every keypress after the first
goes to the search box.

The solution is to call the `.stopPropagation()` and
`.preventDefault()` methods on the key event object for keys you care
about receiving so those events don't bubble up to the browser. This
commit prevents events from propagating if they contribute to an active
sequence. It might make sense to trap any keys that are part of any
sequence, regardless of whether they're the "next" key in any sequence.