Index: ui/views/widget/desktop_aura/x11_desktop_handler.cc |
diff --git a/ui/views/widget/desktop_aura/x11_desktop_handler.cc b/ui/views/widget/desktop_aura/x11_desktop_handler.cc |
index b7ca334936c924ce4cfac5ed073e300c0c6779ae..250b727a53b64737c84cb610791e72a47accfe55 100644 |
--- a/ui/views/widget/desktop_aura/x11_desktop_handler.cc |
+++ b/ui/views/widget/desktop_aura/x11_desktop_handler.cc |
@@ -170,6 +170,15 @@ uint32_t X11DesktopHandler::DispatchEvent(const ui::PlatformEvent& event) { |
::Window window; |
if (ui::GetXIDProperty(x_root_window_, "_NET_ACTIVE_WINDOW", &window) && |
window) { |
+ // Set focus to the modal dialog instead of the host window. |
+ DesktopWindowTreeHostX11* new_host = |
+ views::DesktopWindowTreeHostX11::GetHostForXID(window); |
+ if (new_host && new_host->GetModalDialog()) { |
+ XSetInputFocus(xdisplay_, new_host->GetModalDialog(), |
+ RevertToParent, CurrentTime); |
+ break; |
+ } |
+ |
OnActiveWindowChanged(window, ACTIVE); |
} |
} |