diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2023-07-31 14:48:07 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2023-08-02 05:10:18 +0200 |
commit | 3b1da48e8c5506e366977a5e888ec3897e3e1ca3 (patch) | |
tree | 0c9a917c14a2b177ebc2d317a457e3fcd026e159 /toolkit | |
parent | e4ec702df16e04e66af42e2e35a607cb67d7d2c1 (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 'toolkit')
-rw-r--r-- | toolkit/source/awt/vclxaccessiblecomponent.cxx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx index 19ba5c4fbfc2..36d0451b2575 100644 --- a/toolkit/source/awt/vclxaccessiblecomponent.cxx +++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx @@ -629,7 +629,11 @@ OUString VCLXAccessibleComponent::getAccessibleName( ) { aName = GetWindow()->GetAccessibleName(); #if OSL_DEBUG_LEVEL > 0 - aName += " (Type = " + OUString::number(static_cast<sal_Int32>(GetWindow()->GetType())) + ")"; + // append window type to accessible name for debugging purposes + // if LIBO_APPEND_WINDOW_TYPE_TO_ACCESSIBLE_NAME environment variable is set + static const char* pEnvAppendType = getenv("LIBO_APPEND_WINDOW_TYPE_TO_ACCESSIBLE_NAME"); + if (pEnvAppendType && OUString::createFromAscii(pEnvAppendType) != u"0") + aName += " (Type = " + OUString::number(static_cast<sal_Int32>(GetWindow()->GetType())) + ")"; #endif } return aName; |