handle enter and esc event