Clear all key states when switching to UI focus
Fixes: #367