mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Improve TimelineAccessibilityModifier
This commit is contained in:
committed by
Alfonso Grillo
parent
f7f3404312
commit
30e8753663
@@ -24,8 +24,18 @@ private struct TimelineAccessibilityModifier: ViewModifier {
|
|||||||
switch timelineItem {
|
switch timelineItem {
|
||||||
case is PollRoomTimelineItem, is VoiceMessageRoomTimelineItem:
|
case is PollRoomTimelineItem, is VoiceMessageRoomTimelineItem:
|
||||||
content
|
content
|
||||||
|
case let timelineItem as EventBasedTimelineItemProtocol:
|
||||||
|
content
|
||||||
|
.accessibilityRepresentation {
|
||||||
|
VStack {
|
||||||
|
Text(timelineItem.sender.displayName ?? timelineItem.sender.id)
|
||||||
|
content
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.accessibilityElement(children: .combine)
|
||||||
default:
|
default:
|
||||||
content.accessibilityElement(children: .combine)
|
content
|
||||||
|
.accessibilityElement(children: .combine)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ struct TimelineItemBubbledStylerView<Content: View>: View {
|
|||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
.padding(.vertical, senderNameVerticalPadding)
|
.padding(.vertical, senderNameVerticalPadding)
|
||||||
}
|
}
|
||||||
|
// sender info are read inside the `TimelineAccessibilityModifier`
|
||||||
.accessibilityHidden(true)
|
.accessibilityHidden(true)
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
context.send(viewAction: .tappedOnUser(userID: timelineItem.sender.id))
|
context.send(viewAction: .tappedOnUser(userID: timelineItem.sender.id))
|
||||||
@@ -99,14 +100,6 @@ struct TimelineItemBubbledStylerView<Content: View>: View {
|
|||||||
// Figma overlaps reactions by 3
|
// Figma overlaps reactions by 3
|
||||||
VStack(alignment: alignment, spacing: -3) {
|
VStack(alignment: alignment, spacing: -3) {
|
||||||
messageBubble
|
messageBubble
|
||||||
.accessibilityRepresentation {
|
|
||||||
VStack(spacing: 0) {
|
|
||||||
Text(timelineItem.sender.displayName ?? timelineItem.sender.id)
|
|
||||||
// Workaround: fixes VoiceOver frames offset when children accessibility element aren't combined
|
|
||||||
.frame(height: 0)
|
|
||||||
messageBubble
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.timelineAccessibility(timelineItem)
|
.timelineAccessibility(timelineItem)
|
||||||
|
|
||||||
if !timelineItem.properties.reactions.isEmpty {
|
if !timelineItem.properties.reactions.isEmpty {
|
||||||
|
|||||||
@@ -114,6 +114,8 @@ struct TimelineItemPlainStylerView<Content: View>: View {
|
|||||||
.font(.compound.bodyXS)
|
.font(.compound.bodyXS)
|
||||||
}
|
}
|
||||||
.padding(.top, 16)
|
.padding(.top, 16)
|
||||||
|
// sender info are read inside the `TimelineAccessibilityModifier`
|
||||||
|
.accessibilityHidden(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ struct PollRoomTimelineView: View {
|
|||||||
Image(asset.name)
|
Image(asset.name)
|
||||||
.resizable()
|
.resizable()
|
||||||
.frame(width: iconSize, height: iconSize)
|
.frame(width: iconSize, height: iconSize)
|
||||||
|
.accessibilityHidden(true)
|
||||||
|
|
||||||
Text(poll.question)
|
Text(poll.question)
|
||||||
.multilineTextAlignment(.leading)
|
.multilineTextAlignment(.leading)
|
||||||
|
|||||||
Reference in New Issue
Block a user