Keyboard improvement v1-train

For issue #1322 - Update v1-train with the latest keyboard framework change

Based on pull #1294 - Keyboard improvements

This also fixes some failing tests.

v1-train -> Merge.
Master -> No. This was already done.