From ce101c2c3c04f5ccd46abf7024662d0bc4e5a3a3 Mon Sep 17 00:00:00 2001 From: Lars Schmertmann Date: Mon, 9 Jun 2025 12:32:11 +0200 Subject: [PATCH] Android: Unify behavior of Accessible.description with other platforms On Windows, macOS and iOS both text and description are read out. On Android the description is only used, when there is no name/text and the result is used in AccessibilityNodeInfo::setContentDescription while AccessibilityNodeInfo::setText is ignored. Using the content description only is right, because Android will prioritize description over text. So we need to do our own concatenation to use both. Using ", " as separator looks like the right way, because Android use it to separate the text from the role too. This was checked by enabling TalkBack settings -> Advanced settings -> Developer settings -> Display speech output. Fixes: QTBUG-128494 Pick-to: 6.10 Change-Id: Ib25e993ffc8614b9c9ccdc37207f2c3c496ecb1f Reviewed-by: Assam Boudjelthia --- src/plugins/platforms/android/androidjniaccessibility.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/android/androidjniaccessibility.cpp b/src/plugins/platforms/android/androidjniaccessibility.cpp index 2010a9e03b2..200c2f7a47b 100644 --- a/src/plugins/platforms/android/androidjniaccessibility.cpp +++ b/src/plugins/platforms/android/androidjniaccessibility.cpp @@ -427,8 +427,12 @@ namespace QtAndroidAccessibility if (iface && iface->isValid()) { bool hasValue = false; desc = iface->text(QAccessible::Name); - if (desc.isEmpty()) - desc = iface->text(QAccessible::Description); + const QString descStr = iface->text(QAccessible::Description); + if (!descStr.isEmpty()) { + if (!desc.isEmpty()) + desc.append(QStringLiteral(", ")); + desc.append(descStr); + } if (desc.isEmpty()) { desc = iface->text(QAccessible::Value); hasValue = !desc.isEmpty();