accessibility/inc/extended/accessibletablistbox.hxx |    5 +++++
 include/vcl/accessibletableprovider.hxx             |    4 ++++
 vcl/source/treelist/svtabbx.cxx                     |    7 +++++--
 3 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 1c0f0ab9b5bf23997640f44b7edd45c693c3f74d
Author:     Michael Weghorn <[email protected]>
AuthorDate: Thu Jul 20 10:07:32 2023 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Fri Jul 21 15:02:45 2023 +0200

    tdf#99609 a11y: Handle focused state for cells in tab list box
    
    Report the focusable state for cells in the tab list box,
    and the focused state when the row is selected and child
    focus is on the table or a child.
    
    Not properly reporting the focused state would e.g. prevent Orca from
    announcing the newly focused row in the Expert Configuration dialog
    when using the qt6 VCL plugin.
    (It already worked fine with gtk3 because that one is using
    native Gtk widgets.)
    
    This at least makes the focused state being reported
    properly for the first item ("org.openoffice.VCL")
    in the Expoert Configuration dialog, but others still happen to not
    have the focused state set properly when moving there with the arrow
    down key, so there seems to be another issue somewhere.
    
    pyatspi script that prints state change events:
    
        #!/usr/bin/python3
        import pyatspi
        def listener(e):
            try:
                if e.host_application.name != 'soffice' and 
e.host_application.name != 'soffice.bin':
                    return
            except:
                return
            print(e)
        pyatspi.Registry.registerEventListener(listener, 'object:state-changed')
        pyatspi.Registry.start()
    
    Sample output when moving between entries in the table
    (only "org.openoffice.VCL") has focused state set.
    
        object:state-changed:focused(1, 0, [table | ])
                source: [table | ]
                host_application: [application | soffice.bin]
                sender: [application | soffice.bin]
        object:state-changed:focused(1, 0, [table | ])
                source: [table | ]
                host_application: [application | soffice.bin]
                sender: [application | soffice.bin]
        object:state-changed:focused(0, 0, [table cell | org.openoffice.Inet])
                source: [table cell | org.openoffice.Inet]
                host_application: [application | soffice.bin]
                sender: [application | soffice.bin]
        object:state-changed:focused(1, 0, [table cell | org.openoffice.VCL])
                source: [table cell | org.openoffice.VCL]
                host_application: [application | soffice.bin]
                sender: [application | soffice.bin]
        object:state-changed:focused(0, 0, [table cell | org.openoffice.Inet])
                source: [table cell | org.openoffice.Inet]
                host_application: [application | soffice.bin]
                sender: [application | soffice.bin]
        object:state-changed:focused(0, 0, [table cell | org.openoffice.LDAP])
                source: [table cell | org.openoffice.LDAP]
                host_application: [application | soffice.bin]
                sender: [application | soffice.bin]
        object:state-changed:focused(0, 0, [table cell | org.openoffice.Setup])
                source: [table cell | org.openoffice.Setup]
                host_application: [application | soffice.bin]
                sender: [application | soffice.bin]
    
    Change-Id: I6b532bfd6c3f437e44b3d67da8a5cc5f77b562d2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154671
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx
index 6b8119c1b2d5..2699ec4cfcf6 100644
--- a/vcl/source/treelist/svtabbx.cxx
+++ b/vcl/source/treelist/svtabbx.cxx
@@ -1005,6 +1005,7 @@ void SvHeaderTabListBox::FillAccessibleStateSet( 
sal_Int64& _rStateSet, Accessib
 
 void SvHeaderTabListBox::FillAccessibleStateSetForCell( sal_Int64& _rStateSet, 
sal_Int32 _nRow, sal_uInt16 _nColumn ) const
 {
+    _rStateSet |= AccessibleStateType::FOCUSABLE;
     _rStateSet |= AccessibleStateType::SELECTABLE;
     _rStateSet |= AccessibleStateType::TRANSIENT;
 
@@ -1017,6 +1018,8 @@ void SvHeaderTabListBox::FillAccessibleStateSetForCell( 
sal_Int64& _rStateSet, s
     if ( IsRowSelected( _nRow ) )
     {
         _rStateSet |= AccessibleStateType::ACTIVE;
+        if (HasChildPathFocus())
+            _rStateSet |= AccessibleStateType::FOCUSED;
         _rStateSet |= AccessibleStateType::SELECTED;
     }
     if ( IsEnabled() )
commit 29ab560c21b80e9e5886a8f507300d61047d0ee7
Author:     Michael Weghorn <[email protected]>
AuthorDate: Thu Jul 20 08:33:06 2023 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Fri Jul 21 15:02:37 2023 +0200

    tdf#99609 a11y: Set proper parent for cells in tab list box
    
    The a11y tree was broken: While the table has the cells
    as children, the cells did not have the table set as parent,
    but the table's header.
    
    Since the IAccessibleTableCell implementation in
    winaccessibility relies on the table being set as
    the parent, this wouldn't work when moving around
    within the tree view in the Expert Configuration dialog.
    
    Fix this by setting the table as parent.
    
    The issue could also be observed with the qt6 VCL
    plugin on Linux and Accerciser.
    
    With the table selected in Accerciser's tree view
    of the a11y hierarchy, the incorrect hierarchy could be
    seen using this in Accerciser's IPython console.
    
        In [8]: acc.childCount
        Out[8]: 48
        In [9]: acc.get_child_at_index(4).name
        Out[9]: 'Migration'
        In [10]: acc.get_child_at_index(4).parent == acc
        Out[10]: False
        In [11]: acc.get_child_at_index(4).parent.childCount
        Out[11]: 4
    
    With the fix in place, the table's child's parent is
    now the table again as expected:
    
        In [13]: acc.childCount
        Out[13]: 48
        In [14]: acc.get_child_at_index(4).name
        Out[14]: 'Migration'
        In [15]: acc.get_child_at_index(4).parent == acc
        Out[15]: True
        In [16]: acc.get_child_at_index(4).parent.childCount
        Out[16]: 48
    
    NVDA on Windows now announces *something* when moving
    between rows in the Expert Configuration dialog, but
    it's not the correct row yet.
    (That looks like another issue in winaccessibility code
    that needs to be fixed separately.)
    
    Change-Id: I400fa9811bb297ea7fd1accb0970811cdf11a119
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154670
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/accessibility/inc/extended/accessibletablistbox.hxx 
b/accessibility/inc/extended/accessibletablistbox.hxx
index 3a403ab09af0..b38c1c5ef59d 100644
--- a/accessibility/inc/extended/accessibletablistbox.hxx
+++ b/accessibility/inc/extended/accessibletablistbox.hxx
@@ -80,6 +80,11 @@ public:
         return AccessibleBrowseBox::getHeaderBar( 
AccessibleBrowseBoxObjType::ColumnHeaderBar );
     }
 
+    css::uno::Reference<css::accessibility::XAccessible> getTable() override
+    {
+        return implGetTable();
+    }
+
 private:
     /** dtor() */
     virtual ~AccessibleTabListBox() override;
diff --git a/include/vcl/accessibletableprovider.hxx 
b/include/vcl/accessibletableprovider.hxx
index 63f8580ee801..4986e2504b9c 100644
--- a/include/vcl/accessibletableprovider.hxx
+++ b/include/vcl/accessibletableprovider.hxx
@@ -148,6 +148,10 @@ public:
     virtual css::uno::Reference< css::accessibility::XAccessible >
         getHeaderBar() = 0;
 
+    /** Returns the accessible object for the table.
+     */
+    virtual css::uno::Reference< css::accessibility::XAccessible> getTable() = 
0;
+
 protected:
     ~IAccessibleTabListBox() {}
 };
diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx
index e784d5347f35..6b8119c1b2d5 100644
--- a/vcl/source/treelist/svtabbx.cxx
+++ b/vcl/source/treelist/svtabbx.cxx
@@ -804,10 +804,10 @@ Reference< XAccessible > 
SvHeaderTabListBox::CreateAccessibleCell( sal_Int32 _nR
     bool bIsCheckBox = IsCellCheckBox( _nRow, _nColumnPos, eState );
     if ( bIsCheckBox )
         xChild = 
m_pImpl->m_aFactoryAccess.getFactory().createAccessibleCheckBoxCell(
-                m_pAccessible->getHeaderBar(), *this, nullptr, _nRow, 
_nColumnPos, eState, false );
+                m_pAccessible->getTable(), *this, nullptr, _nRow, _nColumnPos, 
eState, false );
     else
         xChild = 
m_pImpl->m_aFactoryAccess.getFactory().createAccessibleBrowseBoxTableCell(
-                m_pAccessible->getHeaderBar(), *this, nullptr, _nRow, 
_nColumnPos, OFFSET_NONE );
+                m_pAccessible->getTable(), *this, nullptr, _nRow, _nColumnPos, 
OFFSET_NONE );
 
     return xChild;
 }

Reply via email to