fixed condition in keydown event