Refactor keyboard handling

Fixes #4886

This creates a new JS module as `base/keyboard.js` exposed as `IPython.keyboard` for all of our keyboard handling. This is meant to replace the keyboard related stuff in `IPython.utils`. But the removal of the old stuff will come later once we have better tests in place. This should wait for #5053 so tests of `keyboard.js` can be added.