Bug 155625 - GTK3 a11y: some roles not properly updated
Summary: GTK3 a11y: some roles not properly updated
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
7.6.0.0 alpha1+
Hardware: All Linux (All)
: medium normal
Assignee: Michael Weghorn
URL:
Whiteboard: target:24.2.0
Keywords: accessibility
Depends on:
Blocks: a11y, Accessibility
  Show dependency treegraph
 
Reported: 2023-06-01 13:00 UTC by cwendling
Modified: 2023-07-27 15:06 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cwendling 2023-06-01 13:00:03 UTC
Working on GTK3 a11y validation tests, I get unmatched roles for some nodes *if I let the mainloop run a bit* before checking.  This is however visible in a normal run under accerciser as well (although you'd have to trust me for the internal value of the node, or retrieve the info e.g. with a debugger run).

For example, the menu item "Edit -> Find and Replace..." is visible as being a check menu item (why, though? but that's not the point), and it's internal LO representation indeed has role CHECK_MENU_ITEM.  However, AT-SPI sees a role MENU_ITEM (no CHECK, then).

There seem to be some instances where the role is not properly updated on the ATK object.

Note that if I implement AtkObjectWrapper::get_role() this fixes it *but* I'm not confident there wouldn't be some role-changed events missing then.  Unfortunately, I don't have a case where I can trigger a missing change manually during a run, so I can't really tell if an event happens or not.
Comment 1 Michael Weghorn 2023-07-26 11:00:48 UTC
I can reproduce with these steps:

1) apply PS 11 of https://gerrit.libreoffice.org/c/core/+/153069 on top of master (as of 6568a29fa256d143a332b424c0582b0e665b65d6)

2) drop the workaround for this bug here:

diff --git a/vcl/qa/cppunit/a11y/atspi2/atspi2.cxx b/vcl/qa/cppunit/a11y/atspi2/atspi2.cxx
index bbcd263fee0c..762401181bf4 100644
--- a/vcl/qa/cppunit/a11y/atspi2/atspi2.cxx
+++ b/vcl/qa/cppunit/a11y/atspi2/atspi2.cxx
@@ -264,9 +264,6 @@ void Atspi2TestTree::compareObjects(uno::Reference<accessibility::XAccessible> x
      * be represented with a round trip. */
     const auto nLORole = mapToAtspiRole(xLOContext->getAccessibleRole());
     auto nAtspiRole = pAtspiAccessible.getRole();
-    // FIXME: workaround for https://bugs.documentfoundation.org/show_bug.cgi?id=155625
-    if (nLORole == ATSPI_ROLE_CHECK_MENU_ITEM && nAtspiRole == ATSPI_ROLE_MENU_ITEM)
-        nAtspiRole = nLORole;
     CPPUNIT_ASSERT_EQUAL(nLORole, nAtspiRole);
     /* name (no need to worry about debugging suffixes as AccessibilityTools::nameEquals does, as
      * that will also be part of the name sent to ATSPI) */

3) run the test:
   make CppunitTest_vcl_gtk3_a11y

It fails like this:

atspi2.cxx:267:Assertion
Test name: Test1::TestBody
equality assertion failed
- Expected: ATSPI_ROLE_CHECK_MENU_ITEM
- Actual  : ATSPI_ROLE_MENU_ITEM
Comment 2 Michael Weghorn 2023-07-26 15:16:01 UTC
I'm working on a fix.
Comment 3 Michael Weghorn 2023-07-26 17:14:59 UTC
(In reply to Michael Weghorn from comment #2)
> I'm working on a fix.

-> https://gerrit.libreoffice.org/c/core/+/154947
Comment 4 Commit Notification 2023-07-27 14:59:26 UTC
Michael Weghorn committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/ce0a48a1eb16d6309dba175e032a52eb5ede2542

tdf#155625 a11y: Notify about menu item role change

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.