How can i make a Escape menu close only after i closed an options in that Escape menu


So i have that simple menu and i want it to stay open when i press Escape when in option menu, and that option menu close. How can i do that?