[Accessibility/Linux] Checkable QPushButton announced as "check box" instead of "toggle button"
-
Hi,
On Linux, a checkable QPushButton is announced by Orca as "check box"
instead of "toggle button". On Windows, NVDA correctly says "toggle button".Root Cause
QAccessibleButton::role() returns QAccessible::CheckBox for any checkable
button. The AT-SPI2 bridge maps this to ATSPI_ROLE_CHECK_BOX.
However, ATSPI_ROLE_TOGGLE_BUTTON exists in AT-SPI2 but Qt never uses it.On Windows it works because IToggleProvider is attached to any element
with state().checkable = true, and screen readers announce it as
"toggle button" from that.Reproducer
QPushButton btn("Mute"); btn.setCheckable(true); // Linux/Orca → "check box" // Windows/NVDA → "toggle button"Is there a QTBUG for this?
-
Hi,
For the bugs, you should check the bug report system.
That said, I think it will partly depend on the version of AT-SPI2 used to build Qt. When using more recent versions, I think the text will be associated with ATSPI_ROLE_SWITCH. If that is not the case, then the button is associated with a check box role.
-
I found that Qt 6.11 already addresses this with a new
QAccessible::Switch role (commit 293032a) mapped to
ATSPI_ROLE_SWITCH on Linux and UIA_ButtonControlTypeId on Windows,
which is the proper long-term fix.For 6.10.x, a backport patch in getRole() in atspiadaptor.cpp
seems like a reasonable workaround:if (interface->role() == QAccessible::Button && interface->state().checkable) return ATSPI_ROLE_TOGGLE_BUTTON;Would such a patch be acceptable for 6.10.x, or is the
recommendation to upgrade to 6.11? -
I think 6.10 is arriving to an end but it would be worth asking on the submission that introduced the fix.