diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2023-09-27 14:37:56 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2023-09-27 16:00:29 +0200 |
commit | 1215e1bcb149791ce293c0bcb235fcd9548136c7 (patch) | |
tree | fc72cd8d9f67053488ba9938909d3b220d6a80e8 /vcl | |
parent | c2ab40af9efd19d386a486a934986731b7a80d6d (diff) |
gtk4 a11y: Map paragraph role to Gtk equivalent
Map `css::accessibility::AccessibleRole::PARAGRAPH`
to the new `GTK_ACCESSIBLE_ROLE_PARAGRAPH` role newly
added to Gtk in commit [1]
commit 9f078bd5c975f33d832b6da71cba2923450d3127
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Mon Sep 25 10:41:42 2023 +0200
a11y: Add paragraph role
Add new GTK_ACCESSIBLE_ROLE_PARAGRAPH role
for paragraphs.
ARIA has a paragraph role as well.
The paragraph role is used e.g. in document editors
like LibreOffice or web browsers like Firefox.
According to the ARIA spec [1], naming paragraphs
is forbidden (ยง 5.2.8.6), and the superclass role
is section.
This role will be more useful once a way to expose
the textual data via the AT-SPI Text interface is
also available (s. issue #5912 [2]).
[1] https://www.w3.org/TR/wai-aria-1.2/
[2] https://gitlab.gnome.org/GNOME/gtk/-/issues/5912
With this in place, a Writer paragraph reports the
proper role to AT-SPI.
There's however currently no way to expose the
paragraph text via the AT-SPI Text interface since
Gtk 4 currently lacks the required API for that (s. [2]).
Without this change in place, the paragraph text was
exposed as the accessible name of the a11y object
(see the "for now set GTK_ACCESSIBLE_PROPERTY_LABEL
as a proof of concept" comment in
`lo_accessible_get_property`), but since ARIA does not
allow naming paragraphs and Gtk 4 follows ARIA, this
is no longer the case with the new mapping in place.
But then, I don't see how to have proper a11y
without supporting the Text interface, so that
will be needed at some point anyway.
[1] https://gitlab.gnome.org/GNOME/gtk/-/commit/9f078bd5c975f33d832b6da71cba2923450d3127
[2] https://gitlab.gnome.org/GNOME/gtk/-/issues/5912
Change-Id: I44315754a6376ecc06bee01d16eedb8a769c3d4a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157241
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/gtk4/a11y.cxx | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/vcl/unx/gtk4/a11y.cxx b/vcl/unx/gtk4/a11y.cxx index 1b9b04e86e01..418037027f48 100644 --- a/vcl/unx/gtk4/a11y.cxx +++ b/vcl/unx/gtk4/a11y.cxx @@ -93,7 +93,11 @@ map_accessible_role(const css::uno::Reference<css::accessibility::XAccessible>& eRole = GTK_ACCESSIBLE_ROLE_WIDGET; break; case css::accessibility::AccessibleRole::PARAGRAPH: +#if GTK_CHECK_VERSION(4, 13, 1) + eRole = GTK_ACCESSIBLE_ROLE_PARAGRAPH; +#else eRole = GTK_ACCESSIBLE_ROLE_GROUP; +#endif break; case css::accessibility::AccessibleRole::FILLER: eRole = GTK_ACCESSIBLE_ROLE_GENERIC; |