Avoid selecting a method if Esc is pressed