From ed31cfebc9ccdc713290d46ed62a752ddfb361eb Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 4 Mar 2019 09:47:59 -0600 Subject: [PATCH] fix: check for pane focus before removing it. (#17164) Fixes #16883. This bug seems to have been introduced in the #15302's menu a11y refactor and is new in 5-0-x. --- atom/browser/ui/views/menu_bar.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/atom/browser/ui/views/menu_bar.cc b/atom/browser/ui/views/menu_bar.cc index 18bb5c2327..7207685fd1 100644 --- a/atom/browser/ui/views/menu_bar.cc +++ b/atom/browser/ui/views/menu_bar.cc @@ -119,7 +119,9 @@ bool MenuBar::GetMenuButtonFromScreenPoint(const gfx::Point& screenPoint, } void MenuBar::OnBeforeExecuteCommand() { - RemovePaneFocus(); + if (GetPaneFocusTraversable() != nullptr) { + RemovePaneFocus(); + } window_->RestoreFocus(); }