Seems both Keypress/KeyUp event could work for both case, is there any specific reason to replace Keypress with keyUp event?