accessibility/source/extended/accessibleiconchoicectrlentry.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit c61f6a78022de6b29f031f3ac6726520032de187
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue May 28 14:44:29 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed May 29 09:46:36 2024 +0200

    a11y: Report focused state for icon choice control entries
    
    Handle the FOCUSABLE and FOCUSED a11y states in
    `AccessibleIconChoiceCtrlEntry::getAccessibleStateSet`.
    
    Without this, the currently focused tab item would
    e.g. not be reported by Orca when using the qt6 VCL
    plugin in Writer's "Insert" -> "Hyperlink" dialog
    or in "Format" -> "Page Style" that was recently
    converted to use vertical tabs.
    
    Monitoring AT-SPI events showed that an
    `object:state-changed:focused` event was sent
    on the AT-SPI layer (see also
    `AccessibleIconChoiceCtrl::ProcessWindowEvent` that sends
    an `AccessibleEventId::ACTIVE_DESCENDANT_CHANGED` event):
    
    However, the focused state is not set, so Orca
    would not report the item as the new focus item:
    
        95.1 object:state-changed:focused(0, 0, [list item | Mail])
                source: [list item | Mail]
                application: [application | soffice.bin]
    
    With this change in place, the state is properly
    set now and Orca announces the newly focused item:
    
        31.0 object:state-changed:focused(1, 0, [list item | Mail])
                source: [list item | Mail]
                application: [application | soffice.bin]
    
    Change-Id: I41667c842e607f494b9e0e236b8c6f2f9ca95dfb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168154
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx 
b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
index 5f4761770f03..95e9c4375004 100644
--- a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
+++ b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
@@ -297,6 +297,7 @@ namespace accessibility
 
         if ( IsAlive_Impl() )
         {
+            nStateSet |= AccessibleStateType::FOCUSABLE;
             nStateSet |= AccessibleStateType::TRANSIENT;
             nStateSet |= AccessibleStateType::SELECTABLE;
             nStateSet |= AccessibleStateType::ENABLED;
@@ -308,7 +309,11 @@ namespace accessibility
             }
 
             if ( m_pIconCtrl && m_pIconCtrl->GetCursor() == 
m_pIconCtrl->GetEntry( m_nIndex ) )
+            {
                 nStateSet |=  AccessibleStateType::SELECTED;
+                if (m_pIconCtrl->HasChildPathFocus())
+                    nStateSet |= AccessibleStateType::FOCUSED;
+            }
         }
         else
             nStateSet |=  AccessibleStateType::DEFUNC;

Reply via email to