refine the keyboard interaction