vcl/uiconfig/ui/combobox.ui |    5 -----
 vcl/unx/gtk3/gtkinst.cxx    |    8 ++++++++
 2 files changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 8d9bb143730c9866ef40b27d374d7b571b71a8b9
Author:     Michael Weghorn <[email protected]>
AuthorDate: Wed Oct 30 12:44:33 2024 +0100
Commit:     Christian Lohmaier <[email protected]>
CommitDate: Thu Nov 28 21:56:03 2024 +0100

    tdf#163684 gtk3 a11y: Don't use combobox role twice for non-editable one
    
    Since
    
        commit 9f078ed7b625e86182d64d5ccfbb410cdd38081c
        Author: Michael Weghorn <[email protected]>
        Date:   Tue May 7 10:04:16 2024 +0200
    
            tdf#160971 gtk3 a11y: Set role for custom editable combobox
    
            Set the combobox a11y role for the box in the .ui file
            used for the custom gtk3 combobox implementation.
    
            With this in place, moving focus to the "Font Name" or
            another editable combobox in the Writer toolbar now
            makes Orca announce that one as "editable combobox"
            rather than just "text".
    
    , the combobox a11y role is set for the GtkBox of
    the custom combobox implementation used for gtk3.
    That box contains the edit (for editable comboboxes)
    and the button.
    
    While this is needed for editable comboboxes for
    AT to identify this as a combobox when the edit
    receives focus (by the fact that the edit's parent
    has a combobox role), this resulted in Orca no
    longer announcing the combobox role when the
    button receives focus for non-editable comboboxes.
    
    While the button also has the combobox role, Orca
    has logic to not announce the role of combobox
    children. (`SpeechGenerator._should_speak_role`
    returns `false` for that case [1].)
    
    To avoid this problem and make announcement for both,
    editable and non-editable comboboxes work as expected,
    no longer set a combobox role for the box in the .ui
    file, but set it only for the editable combobox
    in the C++ code.
    
    [1] 
https://gitlab.gnome.org/GNOME/orca/-/blob/78e44c625ef5fb082907ca484230458624d24ee8/src/orca/speech_generator.py#L365-366
    
    Change-Id: Ia3ff00688f47e61d5a98c79f1a256061b2fb18a8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175823
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>
    (cherry picked from commit cf627ab2c8c070a620c81cff1faf7b6f04205255)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175842
    Reviewed-by: Christian Lohmaier <[email protected]>

diff --git a/vcl/uiconfig/ui/combobox.ui b/vcl/uiconfig/ui/combobox.ui
index a9c697f10bc7..6abaa6a25171 100644
--- a/vcl/uiconfig/ui/combobox.ui
+++ b/vcl/uiconfig/ui/combobox.ui
@@ -67,11 +67,6 @@
         <property name="position">2</property>
       </packing>
     </child>
-    <child internal-child="accessible">
-      <object class="AtkObject" id="box-atkobject">
-        <property name="AtkObject::accessible-role">combo-box</property>
-      </object>
-    </child>
     <style>
       <class name="linked"/>
     </style>
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index d83d209f7974..d8844aacc65b 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -22281,6 +22281,14 @@ public:
             m_nEntryKeyPressEventSignalId = g_signal_connect(m_pEntry, 
"key-press-event", G_CALLBACK(signalEntryKeyPress), this);
             m_nEntryPopulatePopupMenuSignalId = g_signal_connect(m_pEntry, 
"populate-popup", G_CALLBACK(signalEntryPopulatePopup), nullptr);
             m_nKeyPressEventSignalId = 0;
+
+            // for editable combobox, set a11y combobox role for the box 
containing the entry
+            // (in addition to the button for which this is already set in the 
.ui file that
+            // gets focus in case of the the non-editable combobox)
+            GtkWidget* pBox = GTK_WIDGET(gtk_builder_get_object(pComboBuilder, 
"box"));
+            assert(pBox);
+            if (AtkObject* pBoxAccessible = gtk_widget_get_accessible(pBox))
+                atk_object_set_role(pBoxAccessible, ATK_ROLE_COMBO_BOX);
         }
         else
         {

Reply via email to