Menu bar: Simplified code and fixed keyboard handling after sub-menu closed.
Merge pull request #2763 from pjackson28/menubartabindexfix

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