summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2022-12-15 12:25:52 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2022-12-15 18:31:51 +0100
commit095604c9af90989957c974549bafdb0518c2ed3f (patch)
treee80746bdac4b0ad1a386cd68e21aef5a16c94676 /src/plugins/platforms/ios
parentf2b49789b2f9f9145d318a00868d2f054052aee4 (diff)
iOS a11y: Ensure parent elements are stacked below their children
The accessibility system on iOS does not support elements that are both accessible themselves, and act as a container for other elements. You either return YES from isAccessibilityElement, which allows you to report accessible properties for the element, or NO, in which case you can implement the informal UIAccessibilityContainer protocol to report child elements. This was confirmed in Apple Q&A session on accessibility December 14. As Qt's accessibility system allow elements that are both containers and have properties of their own, we can't build a hierarchy of elements and containers, with only the leaf elements being accessible. Instead, we let each UIView act as a UIAccessibilityContainer, and report the entire child hierarchy as a single level of sibling accessible elements. In doing so, we include elements such as the Window or Dialog that root all the accessible elements. And apparently the order that we report these elements back to iOS determine the z-order of the elements, so we need to ensure "container" elements are behind their children. Otherwise assistive technologies such as Voice Control, or the Accessibility Inspector, will not be able to target the child elements. Fixes: QTBUG-108848 Pick-to: 6.2 6.4 6.5 5.15 Change-Id: I5234bab2f14d5f368ae8c2672b051efcb80aa77d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/plugins/platforms/ios')
-rw-r--r--src/plugins/platforms/ios/quiview_accessibility.mm4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/plugins/platforms/ios/quiview_accessibility.mm b/src/plugins/platforms/ios/quiview_accessibility.mm
index bb27d832d1..366141ef81 100644
--- a/src/plugins/platforms/ios/quiview_accessibility.mm
+++ b/src/plugins/platforms/ios/quiview_accessibility.mm
@@ -23,9 +23,11 @@
if (!iface || iface->state().invisible)
return;
- [self createAccessibleElement: iface];
for (int i = 0; i < iface->childCount(); ++i)
[self createAccessibleContainer: iface->child(i)];
+
+ // The container element must go last, so that it underlays all its children
+ [self createAccessibleElement:iface];
}
- (void)initAccessibility