┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kitemlistcontainer.cpp
diff options
context:
space:
mode:
authorFelix Ernst <[email protected]>2024-11-02 00:39:19 +0100
committerFelix Ernst <[email protected]>2024-12-05 15:42:53 +0000
commit179e53591b726acc0c5272e728e398de41fb51c9 (patch)
tree3fa159c1f044a3d2ad144332ab64f6a495119b14 /src/kitemviews/kitemlistcontainer.cpp
parentdaf5a04d6d34e40ba0ad03d778566be0c3ebea95 (diff)
Adapt to Orca 47
The screen reader Orca has seen some fundamental changes between Orca 46 and Orca 47. While they are improvements overall, they do require changes to Dolphin to preserve the intended user experience for Orca users. The biggest change is perhaps that Orca will now not only announce changes to the currently focused item, but also of its parent, which means we do not need to pass focus around between file items and the main view within Dolphin, but can keep focus on the file items most of the time. This commit implements this. The only exception of when we cannot have focus on the items within the main view is when the current location is empty or not loaded yet. Only then is the focus moved to the view itself and the placeholderMessage is announced. This commit worsens the UX for users of Orca 46 or older, so this should only be merged once most users are on Orca 47 or later.
Diffstat (limited to 'src/kitemviews/kitemlistcontainer.cpp')
-rw-r--r--src/kitemviews/kitemlistcontainer.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/kitemviews/kitemlistcontainer.cpp b/src/kitemviews/kitemlistcontainer.cpp
index ff12aee7c..128140e2e 100644
--- a/src/kitemviews/kitemlistcontainer.cpp
+++ b/src/kitemviews/kitemlistcontainer.cpp
@@ -13,7 +13,7 @@
#include "private/kitemlistsmoothscroller.h"
#ifndef QT_NO_ACCESSIBILITY
-#include <QAccessibleEvent>
+#include "accessibility/kitemlistviewaccessible.h"
#endif
#include <QApplication>
#include <QFontMetrics>
@@ -202,11 +202,11 @@ void KItemListContainer::focusInEvent(QFocusEvent *event)
// We need to set the focus to the view or accessibility software will only announce the container (which has no information available itself).
// For some reason actively setting the focus to the view needs to be delayed or the focus will immediately go back to this container.
QTimer::singleShot(0, this, [this, view]() {
- view->setFocus();
+ if (!isAncestorOf(QApplication::focusWidget())) {
+ view->setFocus();
+ }
#ifndef QT_NO_ACCESSIBILITY
- QAccessibleEvent accessibleFocusInEvent(this, QAccessible::Focus);
- accessibleFocusInEvent.setChild(0);
- QAccessible::updateAccessibility(&accessibleFocusInEvent);
+ static_cast<KItemListViewAccessible *>(QAccessible::queryAccessibleInterface(view))->setAccessibleFocusAndAnnounceAll();
#endif
});
}