fix: close autoHide menu bar when focus is lost (#29320)
This commit is contained in:
parent
386572bb86
commit
acce13234e
1 changed files with 6 additions and 1 deletions
|
@ -124,7 +124,10 @@ bool MenuBar::AcceleratorPressed(const ui::Accelerator& accelerator) {
|
||||||
? ui::Accelerator(ui::VKEY_ESCAPE, accelerator.modifiers(),
|
? ui::Accelerator(ui::VKEY_ESCAPE, accelerator.modifiers(),
|
||||||
accelerator.key_state(), accelerator.time_stamp())
|
accelerator.key_state(), accelerator.time_stamp())
|
||||||
: accelerator;
|
: accelerator;
|
||||||
return views::AccessiblePaneView::AcceleratorPressed(translated);
|
bool result = views::AccessiblePaneView::AcceleratorPressed(translated);
|
||||||
|
if (result && !pane_has_focus())
|
||||||
|
root_view_->RestoreFocus();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MenuBar::SetPaneFocusAndFocusDefault() {
|
bool MenuBar::SetPaneFocusAndFocusDefault() {
|
||||||
|
@ -149,6 +152,8 @@ void MenuBar::OnThemeChanged() {
|
||||||
void MenuBar::OnDidChangeFocus(View* focused_before, View* focused_now) {
|
void MenuBar::OnDidChangeFocus(View* focused_before, View* focused_now) {
|
||||||
views::AccessiblePaneView::OnDidChangeFocus(focused_before, focused_now);
|
views::AccessiblePaneView::OnDidChangeFocus(focused_before, focused_now);
|
||||||
SetAcceleratorVisibility(pane_has_focus());
|
SetAcceleratorVisibility(pane_has_focus());
|
||||||
|
if (!pane_has_focus())
|
||||||
|
root_view_->RestoreFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* MenuBar::GetClassName() const {
|
const char* MenuBar::GetClassName() const {
|
||||||
|
|
Loading…
Reference in a new issue