Focus and escape key handling