vcl/source/window/window.cxx |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 24876e5611abbaec9b2fe5fcbcf4be71a10ee366
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Fri May 10 20:29:32 2024 +0100
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Sat May 11 11:30:41 2024 +0200

    lok: Don't dump empty aria properties in every JSON element.
    
    They simply bloat the json to no benefit if the properties are
    empty, avoid serializing empty values.
    
    Change-Id: I83c780d01820ec39acc85899d45ad9e929ad7e76
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167496
    Reviewed-by: Marco Cecchetti <marco.cecche...@collabora.com>
    Tested-by: Michael Meeks <michael.me...@collabora.com>

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index b3585c8d80bf..11386eaa74c9 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3404,13 +3404,17 @@ void Window::DumpAsPropertyTree(tools::JsonWriter& 
rJsonWriter)
 
     if(!pAccLabelFor && !pAccLabelledBy)
     {
-        auto aAria = rJsonWriter.startNode("aria");
+        OUString sAccName = GetAccessibleName();
+        OUString sAccDesc = GetAccessibleDescription();
 
-        OUString sAccString = GetAccessibleName();
-        rJsonWriter.put("label", sAccString);
-
-        sAccString = GetAccessibleDescription();
-        rJsonWriter.put("description", sAccString);
+        if (!sAccName.isEmpty() || !sAccDesc.isEmpty())
+        {
+            auto aAria = rJsonWriter.startNode("aria");
+            if (!sAccName.isEmpty())
+                rJsonWriter.put("label", sAccName);
+            if (!sAccDesc.isEmpty())
+                rJsonWriter.put("description", sAccDesc);
+        }
     }
 
     mpWindowImpl->maDumpAsPropertyTreeHdl.Call(rJsonWriter);

Reply via email to