formula/uiconfig/ui/formuladialog.ui | 31 ++++++++++++++++++++----------- formula/uiconfig/ui/parameter.ui | 15 +++++++++++++++ vcl/source/window/window.cxx | 7 +++++++ 3 files changed, 42 insertions(+), 11 deletions(-)
New commits: commit 75229259aa7c077bdde01e73bded565d73c1a1ff Author: Parth Raiyani <[email protected]> AuthorDate: Wed Sep 3 20:06:33 2025 +0530 Commit: Caolán McNamara <[email protected]> CommitDate: Tue Feb 24 20:37:52 2026 +0100 Improve accessibility by adding static roles to GtkLabels - Adds static accessibility roles to GtkLabels to ensure proper rendering and enhance compatibility with assistive technologies - Introduces new `renderAsStatic` property in JSON which is set inside DumpAsPropertyTree method when label has static accessibility role Signed-off-by: Parth Raiyani <[email protected]> Change-Id: I8b8d0005b60fdda2af44eb87186e0b7982ee91f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190558 Reviewed-by: Szymon Kłos <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200232 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins diff --git a/formula/uiconfig/ui/formuladialog.ui b/formula/uiconfig/ui/formuladialog.ui index 2cb9707c0266..44da712fc5e0 100644 --- a/formula/uiconfig/ui/formuladialog.ui +++ b/formula/uiconfig/ui/formuladialog.ui @@ -234,23 +234,17 @@ <property name="can-focus">False</property> <property name="halign">start</property> <property name="hexpand">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="editname-atkobject"> + <property name="AtkObject::accessible-role">static</property> + </object> + </child> </object> <packing> <property name="left-attach">0</property> <property name="top-attach">0</property> </packing> </child> - <child> - <object class="GtkLabel" id="label3"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="hexpand">True</property> - </object> - <packing> - <property name="left-attach">1</property> - <property name="top-attach">0</property> - </packing> - </child> </object> <packing> <property name="expand">False</property> @@ -323,6 +317,11 @@ <attributes> <attribute name="weight" value="bold"/> </attributes> + <child internal-child="accessible"> + <object class="AtkObject" id="headline-atkobject"> + <property name="AtkObject::accessible-role">static</property> + </object> + </child> </object> <packing> <property name="expand">True</property> @@ -346,6 +345,11 @@ <property name="wrap">True</property> <property name="xalign">0</property> <property name="yalign">0</property> + <child internal-child="accessible"> + <object class="AtkObject" id="funcname-atkobject"> + <property name="AtkObject::accessible-role">static</property> + </object> + </child> </object> <packing> <property name="left-attach">0</property> @@ -361,6 +365,11 @@ <property name="wrap">True</property> <property name="xalign">0</property> <property name="yalign">0</property> + <child internal-child="accessible"> + <object class="AtkObject" id="funcdesc-atkobject"> + <property name="AtkObject::accessible-role">static</property> + </object> + </child> <attributes> <attribute name="scale" value="0.9"/> </attributes> diff --git a/formula/uiconfig/ui/parameter.ui b/formula/uiconfig/ui/parameter.ui index a646a6ffc12b..dc35e979f2fa 100644 --- a/formula/uiconfig/ui/parameter.ui +++ b/formula/uiconfig/ui/parameter.ui @@ -28,6 +28,11 @@ <property name="wrap">True</property> <property name="xalign">0</property> <property name="yalign">0</property> + <child internal-child="accessible"> + <object class="AtkObject" id="editdesc-atkobject"> + <property name="AtkObject::accessible-role">static</property> + </object> + </child> </object> <packing> <property name="expand">False</property> @@ -41,6 +46,11 @@ <property name="can-focus">False</property> <property name="halign">start</property> <property name="hexpand">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="parname-atkobject"> + <property name="AtkObject::accessible-role">static</property> + </object> + </child> </object> <packing> <property name="expand">False</property> @@ -58,6 +68,11 @@ <property name="wrap">True</property> <property name="xalign">0</property> <property name="yalign">0</property> + <child internal-child="accessible"> + <object class="AtkObject" id="pardesc-atkobject"> + <property name="AtkObject::accessible-role">static</property> + </object> + </child> <attributes> <attribute name="scale" value="0.9"/> </attributes> diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index c2ad8872878c..9fddc0b91daa 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -65,6 +65,7 @@ #include <dndeventdispatcher.hxx> #include <com/sun/star/accessibility/AccessibleRelation.hpp> +#include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/XAccessibleEditableText.hpp> @@ -3391,6 +3392,12 @@ void Window::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) } } + // If GtkLabel has a static accessibility role, mark renderAsStatic. + // so LOK renders it as <span> instead of <label> for correct accessibility. + sal_uInt16 nAccessibleRole = GetAccessibleRole(); + if (nAccessibleRole == css::accessibility::AccessibleRole::STATIC && GetType() == WindowType::FIXEDTEXT) + rJsonWriter.put("renderAsStatic", true); + vcl::Window* pAccLabelFor = getAccessibleRelationLabelFor(); if (pAccLabelFor) rJsonWriter.put("labelFor", pAccLabelFor->get_id());
