// We can end up here if the user clicked a device in the Places Panel
// which had been unmounted earlier, see https://bugs.kde.org/show_bug.cgi?id=161385.
reloadView();
+
+ m_activeViewContainer->view()->setFocus(); // We always want the focus on the view after activating a place.
} else {
view->disableUrlNavigatorSelectionRequests();
changeUrl(url);
showPlacesPanelAction->trigger();
QVERIFY(placesPanel->isVisible());
QVERIFY2(placesPanel->hasFocus(), "Enabling the Places panel should move keyboard focus there.");
+
+ /// Test that activating a place always moves focus to the view.
+ QTest::keyClick(QApplication::focusWidget(), Qt::Key::Key_Enter);
+ QVERIFY2(m_mainWindow->activeViewContainer()->isAncestorOf(QApplication::focusWidget()),
+ "Activating a place should move focus to the view that loads that place.");
+
+ focusPlacesPanelAction->trigger();
+ QVERIFY(placesPanel->hasFocus());
+
+ QTest::keyClick(QApplication::focusWidget(), Qt::Key::Key_Enter);
+ QVERIFY2(m_mainWindow->activeViewContainer()->isAncestorOf(QApplication::focusWidget()),
+ "Activating a place should move focus to the view even if the view already has that place loaded.");
}
/**