diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp
index 1555395c741e6f177be1e15cb3d90dfba281f7c6..bde3a7ae25c95ac1eb213221bd607bbdc75f0cef 100644
--- a/src/plugins/coreplugin/mainwindow.cpp
+++ b/src/plugins/coreplugin/mainwindow.cpp
@@ -1078,8 +1078,8 @@ void MainWindow::updateFocusWidget(QWidget *old, QWidget *now)
 {
     Q_UNUSED(old)
 
-    // Prevent changing the context object just because the menu is activated
-    if (qobject_cast<QMenuBar*>(now))
+    // Prevent changing the context object just because the menu or a menu item is activated
+    if (qobject_cast<QMenuBar*>(now) || qobject_cast<QMenu*>(now))
         return;
 
     IContext *newContext = 0;