try doing something like

if menu is not focused on then
hide menu
end if

i know there's a way to do that but i just cant remember the code right now.. i dont have a good memory.