Index: ui/views/corewm/focus_controller.cc |
diff --git a/ui/views/corewm/focus_controller.cc b/ui/views/corewm/focus_controller.cc |
index 1daba43ccef717480513e41273af4d8f42515a7f..eaab15101820708b88242137c2ffe4cd836e7915 100644 |
--- a/ui/views/corewm/focus_controller.cc |
+++ b/ui/views/corewm/focus_controller.cc |
@@ -336,7 +336,11 @@ void FocusController::WindowLostFocusFromDispositionChange( |
} |
void FocusController::WindowFocusedFromInputEvent(aura::Window* window) { |
- FocusWindow(window); |
+ // Only focus |window| if it or any of its parents can be focused. Otherwise |
+ // FocusWindow() will focus the topmost window, which may not be the |
+ // currently focused one. |
+ if (rules_->CanFocusWindow(GetToplevelWindow(window))) |
+ FocusWindow(window); |
} |
} // namespace corewm |