vcl/source/control/fixed.cxx |   12 ++++++++++++
 vcl/source/window/window.cxx |    8 +++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

New commits:
commit e3d89856d12d95e86bbb1be32182e00b92879cc7
Author:     Parth Raiyani <[email protected]>
AuthorDate: Wed Jan 28 16:14:56 2026 +0530
Commit:     Caolán McNamara <[email protected]>
CommitDate: Thu Feb 26 22:38:39 2026 +0100

    a11y: enhance accessibility by improving renderAsStatic logic
    
    - add renderAsStatic flag for static and notification roles
    - introduce renderAsStatic logic for SelectableFixedText window type
    
    Signed-off-by: Parth Raiyani <[email protected]>
    Change-Id: Ib4cbf35874d3f800627d88a26072be817c5c0e71
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198318
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200508

diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index 96a77b2367f4..9a7e985a81d0 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -30,6 +30,8 @@
 #include <sal/log.hxx>
 #include <tools/json_writer.hxx>
 #include <tools/stream.hxx>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+
 
 #define FIXEDLINE_TEXT_BORDER    4
 
@@ -460,6 +462,16 @@ void 
SelectableFixedText::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
     Edit::DumpAsPropertyTree(rJsonWriter);
     rJsonWriter.put("type", "fixedtext");
     rJsonWriter.put("selectable", true);
+
+    // Add renderAsStatic for accessibility
+    sal_uInt16 nAccessibleRole = GetAccessibleRole();
+    const std::initializer_list<sal_uInt16> staticRoles = {
+        css::accessibility::AccessibleRole::STATIC,
+        css::accessibility::AccessibleRole::NOTIFICATION
+    };
+
+    if (std::find(staticRoles.begin(), staticRoles.end(), nAccessibleRole) != 
staticRoles.end())
+        rJsonWriter.put("renderAsStatic", true);
 }
 
 void FixedLine::ImplInit( vcl::Window* pParent, WinBits nStyle )
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 7c44f63d369f..217d055a7a3f 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3414,7 +3414,13 @@ void Window::DumpAsPropertyTree(tools::JsonWriter& 
rJsonWriter)
     // so LOK renders it as <span> instead of <label> for correct 
accessibility.
     OUString sAccRole;
     sal_uInt16 nAccessibleRole = GetAccessibleRole();
-    if (nAccessibleRole == css::accessibility::AccessibleRole::STATIC && 
GetType() == WindowType::FIXEDTEXT)
+    const std::initializer_list<sal_uInt16> staticRoles = {
+        css::accessibility::AccessibleRole::STATIC,
+        css::accessibility::AccessibleRole::NOTIFICATION
+    };
+
+    if (std::find(staticRoles.begin(), staticRoles.end(), nAccessibleRole) != 
staticRoles.end()
+        && GetType() == WindowType::FIXEDTEXT)
         rJsonWriter.put("renderAsStatic", true);
     else if (nAccessibleRole == 
css::accessibility::AccessibleRole::PAGE_TAB_LIST)
         sAccRole = "tablist";

Reply via email to