svx/source/form/labelitemwindow.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit e0cedca04770e19b9de177bfc660387fc2bd0bae
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Nov 29 11:32:30 2024 +0100
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Sun Dec 1 12:08:07 2024 +0100

    tdf#163989 a11y: Avoid "showing" event on empty notification label
    
    The label in the search bar has a notification a11y role
    in order for the text (like "Search key not found") to
    be announced when screen readers receive an event indicating that the
    notification became visible (an object:state-changed:showing
    event for AT-SPI on Linux).
    
    However,
    
        commit 48ba98a51f029cd14b5d982dab36eb581d40fef3
        Date:   Wed Nov 29 14:29:57 2023 +0100
    
            Resolves tdf#158412 - Don't show chevron in quick find bar
    
    caused this event to be triggered also when the label has no
    text, which resulted in Orca just saying "Notification", without
    any indication what that notification might be.
    
    Avoid that by not setting the label to hidden at the beginning
    of LabelItemWindow::set_label if the label text is empty, so setting
    it to visible again doesn't have any effect if it's already visible
    when the method gets called.
    
    An alternative might be to switch to using dedicated
    notification events instead of using a label with
    a notification a11y role, now that that kind of event
    is available in AT-SPI2 since at-spi2-core-commit [1]
    
        commit 26835da29918be2c0da6c08fb70d893de22891d2
        Author: Mike Gorse <mgo...@suse.com>
        Date:   Thu Aug 4 12:38:27 2022 -0500
    
                Add an "announcement" event/signal to allow objects to send 
notifications
    
                Fixes #63
    
    [1] 
https://gitlab.gnome.org/GNOME/at-spi2-core/-/commit/26835da29918be2c0da6c08fb70d893de22891d2
    
    Change-Id: Ia4fbf9544f72e10c74e92487619222d59f55cfa1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177523
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    (cherry picked from commit 9f5dfd3986e9c51b5e33b58d6acb0629e19e5d00)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177535
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/svx/source/form/labelitemwindow.cxx 
b/svx/source/form/labelitemwindow.cxx
index b364bd523ed8..eac9f68bb79b 100644
--- a/svx/source/form/labelitemwindow.cxx
+++ b/svx/source/form/labelitemwindow.cxx
@@ -37,7 +37,11 @@ void LabelItemWindow::SetOptimalSize()
 
 void LabelItemWindow::set_label(const OUString& rLabel, const 
LabelItemWindowType eType)
 {
-    m_xLabel->set_visible(false); // a11y announcement
+    // hide temporarily, to trigger a11y announcement for SHOWING event for
+    // the label with NOTIFICATION a11y role when label gets shown again below
+    if (!rLabel.isEmpty())
+        m_xLabel->set_visible(false);
+
     m_xLabel->set_label(rLabel);
     if ((eType == LabelItemWindowType::Text) || rLabel.isEmpty())
     {

Reply via email to