summaryrefslogtreecommitdiffstats
path: root/src/gui/accessible
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2022-06-15 16:39:52 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2022-08-17 15:02:26 +0000
commitf3509565480107c2587212f7d55cc5f92facc417 (patch)
tree160682ae6d93afa59b78d18a8acff2e99582df76 /src/gui/accessible
parent64e6233252117415d6765b6f7a8f4df39490b678 (diff)
a11y atspi: Forward change of focused state
The focused state exists in both, Qt (QAccessible::State::focused) and AT-SPI, so forwarding changes to that state is straightforward. However, so far, changes to the focused state in a QAccessible::StateChanged event were just ignored and not forwarded to the AT-SPI layer. While announcing focus changes to Qt's own widgets works without that because it uses events of type QAccessible::Focus instead of QAccessibleStateChangeEvent with the focused state set, this is not exactly the same and just ignoring the focused state in QAccessible::StateChanged events e.g. turned out to be one cause for the Orca screen reader not announcing UI elements when they received focus in the Qt-based UI variant of LibreOffice, which uses QAccessible::StateChanged with the focused flag set (s.a. LibreOffice commit [1]). [1] https://git.libreoffice.org/core/commit/8c3e8af0e60865ec6d38e2117efdb4ed2f10a20c Change-Id: If226af28960048c56af32979477605d6860e30e9 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/gui/accessible')
-rw-r--r--src/gui/accessible/linux/atspiadaptor.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gui/accessible/linux/atspiadaptor.cpp b/src/gui/accessible/linux/atspiadaptor.cpp
index 6a51107531..f857d1985a 100644
--- a/src/gui/accessible/linux/atspiadaptor.cpp
+++ b/src/gui/accessible/linux/atspiadaptor.cpp
@@ -1066,6 +1066,11 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
notifyStateChange(iface, "enabled"_L1, enabled);
notifyStateChange(iface, "sensitive"_L1, enabled);
+ } else if (stateChange.focused) {
+ QAccessibleInterface *iface = event->accessibleInterface();
+ QAccessible::State state = iface->state();
+ bool focused = state.focused;
+ notifyStateChange(iface, "focused"_L1, focused);
}
}
break;