Better key state handling on input type change