┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorFelix Ernst <[email protected]>2024-11-29 18:57:37 +0100
committerFelix Ernst <[email protected]>2024-12-04 13:19:48 +0000
commitc073cd3c9ac8fc91f4aafe1aefba70ccac7905b1 (patch)
tree79862cfbf73c8279f9a0c75d00eab87af682fee3 /src/tests
parent79a71ae1839b1a68c61f2020fdfd37175d59cf06 (diff)
Always focus the view after place activation
This one-liner makes sure keyboard focus always moves to the active view when a place in the places panel is activated. Previously focus would remain on the places panel if the activated location was identical to the already displayed location. This added consistency is helpful because keyboard-only users will get used to be able to move from the places panel to the view by pressing the Enter key, even though this does not always work prior to this commit. This issue was identified in an accessibility scan done by HAN University of Applied Science.
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/dolphinmainwindowtest.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tests/dolphinmainwindowtest.cpp b/src/tests/dolphinmainwindowtest.cpp
index cd68bb893..6ac85e4f0 100644
--- a/src/tests/dolphinmainwindowtest.cpp
+++ b/src/tests/dolphinmainwindowtest.cpp
@@ -456,6 +456,18 @@ void DolphinMainWindowTest::testFocusPlacesPanel()
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.");
}
/**