vcl/unx/gtk4/a11y.cxx | 4 ++++ 1 file changed, 4 insertions(+) New commits: commit 1215e1bcb149791ce293c0bcb235fcd9548136c7 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Sep 27 14:37:56 2023 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Wed Sep 27 16:00:29 2023 +0200
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.wegh...@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.wegh...@posteo.de> 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;