refactor keydown, keypress, onblur event postprocessing