Bug 1040598 - Introduce StateManager and remove keyboard.js

*remaining*