keydown handler for enter and esc