From 179e53591b726acc0c5272e728e398de41fb51c9 Mon Sep 17 00:00:00 2001 From: Felix Ernst Date: Sat, 2 Nov 2024 00:39:19 +0100 Subject: 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. --- src/kitemviews/kitemlistcontainer.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/kitemviews/kitemlistcontainer.cpp') 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 +#include "accessibility/kitemlistviewaccessible.h" #endif #include #include @@ -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(QAccessible::queryAccessibleInterface(view))->setAccessibleFocusAndAnnounceAll(); #endif }); } -- cgit v1.3