map escape key to a function
configure preferred size and handle escape key