From bad9d473d3ed1f6d870d3c5b159d943b2ef87f4f Mon Sep 17 00:00:00 2001 From: Fushan Wen Date: Tue, 18 Oct 2022 20:38:35 +0800 Subject: [PATCH] Send accessible focus event after list view has focus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QListView::currentChanged sends an accessible focus event even if the list view doesn't have focus. For screen readers like Orca, accessible focus events will be ignored if the target item does not have focus when screen reader receives the event. This corrects the behavior by calling QAbstractItemView::currentChanged before sending an accessible focus event. Change-Id: I71732f62e2f27d7856b4781b268495b88b24b715 Reviewed-by: Jan Arve Sæther (cherry picked from commit 2cf5253b91d5269e387c68d06f58f00ec36e80c0) Reviewed-by: Qt Cherry-pick Bot --- src/widgets/itemviews/qlistview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 30bf327af7a..a2f3f0a2b6c 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -3398,6 +3398,7 @@ void QIconModeViewBase::updateContentsSize() */ void QListView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) { + QAbstractItemView::currentChanged(current, previous); #if QT_CONFIG(accessibility) if (QAccessible::isActive()) { if (current.isValid()) { @@ -3408,7 +3409,6 @@ void QListView::currentChanged(const QModelIndex ¤t, const QModelIndex &pr } } #endif - QAbstractItemView::currentChanged(current, previous); } /*!