summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-07-31 14:48:07 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2023-08-02 05:10:18 +0200
commit3b1da48e8c5506e366977a5e888ec3897e3e1ca3 (patch)
tree0c9a917c14a2b177ebc2d317a457e3fcd026e159 /test
parente4ec702df16e04e66af42e2e35a607cb67d7d2c1 (diff)
a11y: Don't always append window type to a11y name in debug builds
Appending " (Type = <number>)" to the accessible name is probably meant for debugging purposes to see what type of window is involved, but doing that by default in debug builds has disadvantages, e.g.: 1) It affects how assistive tooling, like screen readers, handles the accessible objects, therefore the behaviour with a debug build (what a developer working on something experiences) does not necessarily match what happens in non-debug builds (what end users will experience). For instance, when Orca announces the "Update styles" push button in Writer's formatting toolbar, it not only announces the extra type information for the objects in the hierarchy it announces anyway, but announces the panel in addition, since it has a non-empty name due to the appended type information. Announcement without this change in place (from Orca log): INFO:speech:SPEECH OUTPUT: ' (Type = 371) panel.' INFO:speech:SPEECH OUTPUT: 'Formatting (Type = 356) tool bar' INFO:speech:SPEECH OUTPUT: 'Update push button.' Announcement with this change in place: INFO:speech:SPEECH OUTPUT: 'Formatting tool bar' INFO:speech:SPEECH OUTPUT: 'Update push button.' 2) It breaks selecting the object under the mouse cursor in Accerciser at least with the qt6 VCL plugin when the object is in a dialog, because the window name retrieved via the accessibility APIs (with the appended type information) does not match the one retrieved via Wnck [1]. Therefore, don't append the type information by default, but only if environment variable `LIBO_APPEND_WINDOW_TYPE_TO_ACCESSIBLE_NAME` ist set (typically `LIBO_APPEND_WINDOW_TYPE_TO_ACCESSIBLE_NAME=1`, but any value other than "0" will do), so that can still be used for cases where having the type as part of the accessible name is useful. [1] https://gitlab.gnome.org/GNOME/accerciser/-/blob/5af3fdbfb8a7832e434ad6fc7d2ecaad18f2e32e/plugins/quick_select.py#L109 Change-Id: Ie33b14fbdf9731b02c8c620d7a5ac718ef99367d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155094 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'test')
-rw-r--r--test/source/a11y/AccessibilityTools.cxx18
1 files changed, 11 insertions, 7 deletions
diff --git a/test/source/a11y/AccessibilityTools.cxx b/test/source/a11y/AccessibilityTools.cxx
index b51c7cbac239..d19c42b388e0 100644
--- a/test/source/a11y/AccessibilityTools.cxx
+++ b/test/source/a11y/AccessibilityTools.cxx
@@ -190,14 +190,18 @@ bool AccessibilityTools::nameEquals(const uno::Reference<accessibility::XAccessi
#if OSL_DEBUG_LEVEL > 0
// see VCLXAccessibleComponent::getAccessibleName()
- auto pVCLXAccessibleComponent = dynamic_cast<VCLXAccessibleComponent*>(xCtx.get());
- if (pVCLXAccessibleComponent)
+ static const char* pEnvAppendType = getenv("LIBO_APPEND_WINDOW_TYPE_TO_ACCESSIBLE_NAME");
+ if (pEnvAppendType && OUString::createFromAscii(pEnvAppendType) != u"0")
{
- auto windowType = pVCLXAccessibleComponent->GetWindow()->GetType();
- if (rest
- == Concat2View(u" (Type = " + OUString::number(static_cast<sal_Int32>(windowType))
- + ")"))
- return true;
+ auto pVCLXAccessibleComponent = dynamic_cast<VCLXAccessibleComponent*>(xCtx.get());
+ if (pVCLXAccessibleComponent)
+ {
+ auto windowType = pVCLXAccessibleComponent->GetWindow()->GetType();
+ if (rest
+ == Concat2View(u" (Type = " + OUString::number(static_cast<sal_Int32>(windowType))
+ + ")"))
+ return true;
+ }
}
#endif
return false;