Skip to content

Commit

Permalink
Fix accessibility for dialogs (#1678)
Browse files Browse the repository at this point in the history
Add delay to wait until all elements in semantic tree are finalised

Fixes
https://youtrack.jetbrains.com/issue/CMP-6938/Accessibility-does-not-work-for-dialogs-with-platformLayers-enabled

## Release Notes
### Fixes - iOS
- Fix Accessibility Items availability inside dialogs
  • Loading branch information
ASalavei authored Nov 6, 2024
1 parent 0a57383 commit e7dfb92
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1187,9 +1187,15 @@ internal class AccessibilityMediator(
fun onLayoutChange(nodeId: Int) {
debugLogger?.log("onLayoutChange (nodeId=$nodeId)")

invalidatedBoundsNodeIds.add(nodeId)
// TODO: Properly implement layout invalidation, taking into account that semantics
// can also change after the `onLayoutChange` event.
if (accessibilityElementsMap[nodeId] == null) {
// Forcing tree recalculation when a node with unknown nodeId occurred.
invalidationKind = SemanticsTreeInvalidationKind.COMPLETE
} else {
invalidatedBoundsNodeIds.add(nodeId)
}

// unprocessedInvalidationKind will be set to BOUNDS in sync(), it's a strict subset of COMPLETE
invalidationChannel.trySend(Unit)
}

Expand Down

0 comments on commit e7dfb92

Please sign in to comment.