Conversation
goderbauer
left a comment
There was a problem hiding this comment.
So, live regions do not work on iOS? We have them hooked up to UIAccessibilityTraitUpdatesFrequently - maybe that's not the correct mapping?
And should this maybe live in the iOS accessibility bridge to make iOS announce whenever the value of a live region changes instead of special casing this in the framework just for snackbars?
| @override | ||
| void assembleSemanticsNode(SemanticsNode node, SemanticsConfiguration config, Iterable<SemanticsNode> children) { | ||
| super.assembleSemanticsNode(node, config, children); | ||
| if (defaultTargetPlatform == TargetPlatform.iOS && node.label != null && node.label != _lastAnnouncedLabel) { |
There was a problem hiding this comment.
Can you use a switch over the defaultTargetPlatform so the analyser reminds us to check this place whenever we add a new TargetPlatform?
| super.assembleSemanticsNode(node, config, children); | ||
| if (defaultTargetPlatform == TargetPlatform.iOS && node.label != null && node.label != _lastAnnouncedLabel) { | ||
| _lastAnnouncedLabel = node.label; | ||
| SemanticsService.announce(_lastAnnouncedLabel, textDirection); |
There was a problem hiding this comment.
This seems hacky to make an announcement as a side effect of assembling the tree...
There was a problem hiding this comment.
Yes, its a bit of a hack. Unfortunately since we take a child: Widget instead of a text String I don't think we have a better way of figuring out what to announce until after we've built the semantics tree. We could build a live region concept into our own semantics...
|
Correct, there is no live region concept on iOS, which ties our hands here a bit. The updates frequently trait does not trigger any announcements as far as I can tell, it only changes how the accessibility system reads/polls for the label |
|
Couldn't we do the same thing in the iOS accessibility bridge, though in a more general case: If a node has the live region flag we compare its label/value with the old one and if it has changed, we announce it from there? Basically implement the concept of live regions in the iOS bridge instead of hacking it into individual widgets on the framework side? |
|
Yeah that's a good point. I'll take a look at wiring something up |
Description
Create a custom render semantics which will perform an announcement of the combined semantic label on iOS platforms.
Fixes #41427