mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Accessibility on RRs (#2094)
* added accessibility on the read receipts but there is something wrong in the generation * voice over implementation for RRs * Update ElementX/Sources/Screens/RoomScreen/View/Supplementary/TimelineReadReceiptsView.swift Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com> * done * changelog --------- Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com>
This commit is contained in:
@@ -100,7 +100,11 @@ struct TimelineItemBubbledStylerView<Content: View>: View {
|
||||
VStack(alignment: alignment, spacing: -3) {
|
||||
messageBubble
|
||||
.timelineItemAccessibility(timelineItem) {
|
||||
context.send(viewAction: .timelineItemMenu(itemID: timelineItem.id))
|
||||
if adjustedDeliveryStatus == .sendingFailed {
|
||||
context.sendFailedConfirmationDialogInfo = .init(itemID: timelineItem.id)
|
||||
} else {
|
||||
context.send(viewAction: .timelineItemMenu(itemID: timelineItem.id))
|
||||
}
|
||||
}
|
||||
|
||||
if !timelineItem.properties.reactions.isEmpty {
|
||||
@@ -206,6 +210,7 @@ struct TimelineItemBubbledStylerView<Content: View>: View {
|
||||
|
||||
if adjustedDeliveryStatus == .sendingFailed {
|
||||
CompoundIcon(\.error, size: .xSmall, relativeTo: .compound.bodyXS)
|
||||
.accessibilityLabel(L10n.commonSendingFailed)
|
||||
}
|
||||
}
|
||||
.font(.compound.bodyXS)
|
||||
|
||||
+10
@@ -37,6 +37,16 @@ struct TimelineDeliveryStatusView: View {
|
||||
var body: some View {
|
||||
icon
|
||||
.foregroundColor(.compound.iconSecondary)
|
||||
.accessibilityLabel(accessibilityLabel)
|
||||
}
|
||||
|
||||
private var accessibilityLabel: String {
|
||||
switch deliveryStatus {
|
||||
case .sending:
|
||||
return L10n.commonSending
|
||||
case .sent:
|
||||
return L10n.commonSent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,8 @@ struct TimelineItemStatusView: View {
|
||||
.onTapGesture {
|
||||
context.sendFailedConfirmationDialogInfo = .init(itemID: timelineItem.id)
|
||||
}
|
||||
.accessibilityLabel(L10n.commonSendingFailed)
|
||||
.accessibilityHint(L10n.actionTapForOptions)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+29
-1
@@ -40,12 +40,40 @@ struct TimelineReadReceiptsView: View {
|
||||
}
|
||||
}
|
||||
if timelineItem.properties.orderedReadReceipts.count > displayNumber {
|
||||
let remaining = timelineItem.properties.orderedReadReceipts.count - displayNumber
|
||||
Text("+\(remaining)")
|
||||
.font(.compound.bodySM)
|
||||
.foregroundColor(.compound.textPrimary)
|
||||
}
|
||||
}
|
||||
.accessibilityElement(children: .ignore)
|
||||
.accessibilityLabel(accessibilityLabel)
|
||||
}
|
||||
|
||||
private var remaining: Int {
|
||||
timelineItem.properties.orderedReadReceipts.count - displayNumber
|
||||
}
|
||||
|
||||
private var accessibilityLabel: String {
|
||||
if timelineItem.properties.orderedReadReceipts.count == 1 {
|
||||
return L10n.a11yReadReceiptsSingle(displayName(at: 0))
|
||||
} else if timelineItem.properties.orderedReadReceipts.count <= displayNumber {
|
||||
let limit = timelineItem.properties.orderedReadReceipts.count - 1
|
||||
let list = (0..<limit).map { displayName(at: $0) }.formatted(.list(type: .and, width: .narrow))
|
||||
let last = displayName(at: limit)
|
||||
return L10n.a11ReadReceiptsMultiple(list, last)
|
||||
} else if timelineItem.properties.orderedReadReceipts.count > displayNumber {
|
||||
let list = (0..<displayNumber).map { displayName(at: $0) }.formatted(.list(type: .and, width: .narrow))
|
||||
|
||||
// Plurals with string arguments aren't generated correctly so we need to use this
|
||||
// https://github.com/SwiftGen/SwiftGen/issues/1089
|
||||
return L10n.tr("Localizable", "a11y_read_receipts_multiple_with_others", list, remaining)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
private func displayName(at index: Int) -> String {
|
||||
let userID = timelineItem.properties.orderedReadReceipts[index].userID
|
||||
return context.viewState.members[userID]?.displayName ?? userID
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user