implemented a11y for galleries

This commit is contained in:
Mauro Romito
2026-08-03 13:43:54 +02:00
committed by Mauro
parent 56d22104ad
commit 1407a1d5b4
10 changed files with 107 additions and 1 deletions
@@ -21,6 +21,24 @@ private struct TimelineItemAccessibilityModifier: ViewModifier {
action()
}
}
// A gallery is a container so that each of its attachments can be focussed on its own.
// Everything that isn't an attachment is announced when entering it, as the caption and
// the send info are hidden where they're shown to avoid being read twice.
case let timelineItem as GalleryRoomTimelineItem:
content
.accessibilityElement(children: .contain)
.accessibilityLabel { _ in
Text(timelineItem.sender.displayName ?? timelineItem.sender.id)
if let caption = timelineItem.content.caption, !caption.isBlank {
Text(caption)
}
Text(timelineItem.localizedSendInfo)
}
.accessibilityActions {
Button(L10n.commonMessageActions) {
action()
}
}
case let timelineItem as EventBasedTimelineItemProtocol:
content
.accessibilityRepresentation {