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 <assam.boudjelthia@qt.io>
This commit is contained in:
parent
231069963d
commit
ce101c2c3c
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user