Browse Source

fix: make sure that menu bar gets focus even when you click an item to focus it first (#19763)

trop[bot] 5 years ago
parent
commit
a14285bebe
1 changed files with 6 additions and 0 deletions
  1. 6 0
      atom/browser/ui/views/menu_bar.cc

+ 6 - 0
atom/browser/ui/views/menu_bar.cc

@@ -245,6 +245,12 @@ void MenuBar::OnMenuButtonClicked(views::MenuButton* source,
   if (!window_->HasFocus())
     window_->RequestFocus();
 
+  // This ensures that if you focus the menubar by clicking on an item, you can
+  // still use the arrow keys to move around
+  if (GetPaneFocusTraversable() == nullptr) {
+    SetPaneFocus(source);
+  }
+
   int id = source->tag();
   AtomMenuModel::ItemType type = menu_model_->GetTypeAt(id);
   if (type != AtomMenuModel::TYPE_SUBMENU) {