Menu bar: Simplified code and fixed keyboard handling after sub-menu closed.