summaryrefslogtreecommitdiffstats
path: root/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp')
-rw-r--r--src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
index 8c8e9fb71..27268d26b 100644
--- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
+++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp
@@ -202,6 +202,13 @@ QRectF RenderWidgetHostViewQtDelegateWidget::contentsRect() const
void RenderWidgetHostViewQtDelegateWidget::setKeyboardFocus()
{
+ // If the corresponding window is inactive (for example, because of a popup),
+ // the active focus cannot be set. Sync up with the Window System to try to
+ // reactivate the window in time if the other window (possibly popup) which took
+ // the focus is already closed.
+ if (window() && !window()->isActive())
+ QGuiApplication::sync();
+
m_rootItem->forceActiveFocus();
}