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

New commits:
commit 7277ba00fe5ccc02dc2d666209aefea3f0474175
Author:     Parth Raiyani <[email protected]>
AuthorDate: Wed Jan 28 16:14:56 2026 +0530
Commit:     Caolán McNamara <[email protected]>
CommitDate: Thu Jan 29 13:36:53 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]>

diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx
index 8a366a0d69b3..d653acc2523d 100644
--- a/vcl/source/control/fixed.cxx
+++ b/vcl/source/control/fixed.cxx
@@ -28,6 +28,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
 
@@ -459,6 +461,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 611f3521ebdf..af6f4fc3b13a 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3411,7 +3411,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