Skip to content

Commit d12819b

Browse files
committed
Improve voice over labels and navigation
1 parent a9084a7 commit d12819b

File tree

8 files changed

+64
-3
lines changed

8 files changed

+64
-3
lines changed

DemoAppSwiftUI/ChannelHeader/CustomChannelHeader.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,15 @@ public struct CustomChannelHeader: ToolbarContent {
3636
.background(colors.tintColor)
3737
.clipShape(Circle())
3838
}
39+
.accessibilityLabel(Text("New Channel"))
3940
}
4041
ToolbarItem(placement: .navigationBarLeading) {
4142
Button {
4243
actionsPopupShown = true
4344
} label: {
4445
StreamLazyImage(url: currentUserController.currentUser?.imageURL)
46+
.accessibilityLabel("Account Actions")
47+
.accessibilityAddTraits(.isButton)
4548
}
4649
}
4750
}

Sources/StreamChatSwiftUI/ChatChannel/ChannelHeader/ChatChannelHeaderViewModifier.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,23 @@ public struct DefaultChatChannelHeader: ToolbarContent {
7171
.clipShape(Circle())
7272
.offset(x: 8)
7373
}
74+
.accessibilityLabel(Text(L10n.Channel.Header.Info.title))
7475

7576
NavigationLink(isActive: $isActive) {
7677
LazyView(ChatChannelInfoView(channel: channel, shownFromMessageList: true))
7778
} label: {
7879
EmptyView()
7980
}
80-
81+
.accessibilityHidden(true)
82+
8183
ChannelAvatarView(
8284
avatar: headerImage,
8385
showOnlineIndicator: onlineIndicatorShown,
8486
size: CGSize(width: 36, height: 36)
8587
)
8688
.offset(x: 8)
8789
.allowsHitTesting(false)
90+
.accessibilityHidden(true)
8891
}
8992
.accessibilityIdentifier("ChannelAvatarView")
9093
}

Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListHelperViews.swift

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public struct MessageAuthorAndDateView: View {
2626
}
2727
Spacer()
2828
}
29-
.accessibilityElement(children: .contain)
29+
.accessibilityElement(children: .combine)
3030
.accessibilityIdentifier("MessageAuthorAndDateView")
3131
}
3232
}
@@ -80,11 +80,16 @@ struct MessageDateView: View {
8080
return text
8181
}
8282

83+
var accessibilityLabel: String {
84+
L10n.Message.Cell.sentAt(text)
85+
}
86+
8387
var body: some View {
8488
Text(text)
8589
.font(fonts.footnote)
8690
.foregroundColor(Color(colors.textLowEmphasis))
8791
.animation(nil)
92+
.accessibilityLabel(Text(accessibilityLabel))
8893
.accessibilityIdentifier("MessageDateView")
8994
}
9095
}
@@ -121,7 +126,8 @@ public struct MessageReadIndicatorView: View {
121126
.frame(height: 16)
122127
.accessibilityIdentifier("readIndicatorCheckmark")
123128
}
124-
.accessibilityElement(children: .contain)
129+
.accessibilityElement(children: .combine)
130+
.accessibilityLabel(Text(L10n.Message.Cell.Read.count(readUsers.count)))
125131
.accessibilityIdentifier("MessageReadIndicatorView")
126132
}
127133

@@ -161,6 +167,7 @@ public struct MessagePinDetailsView: View {
161167
Image(uiImage: images.pin)
162168
.customizable()
163169
.frame(maxHeight: 12)
170+
.accessibilityHidden(true)
164171
Text("\(L10n.Message.Cell.pinnedBy) \(message.pinDetails?.pinnedBy.name ?? L10n.Message.Cell.unknownPin)")
165172
.font(fonts.footnote)
166173
}

Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ public struct ScrollToBottomButton: View {
467467
.frame(width: buttonSize, height: buttonSize)
468468
.modifier(ShadowViewModifier(cornerRadius: buttonSize / 2))
469469
}
470+
.accessibilityLabel(Text(L10n.Channel.List.ScrollToBottom.title))
470471
.padding()
471472
.overlay(
472473
unreadCount > 0 ?

Sources/StreamChatSwiftUI/ChatChannelList/MoreChannelActionsView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,14 @@ public struct ChannelMemberView: View {
164164
showOnlineIndicator: onlineIndicatorShown,
165165
size: memberSize
166166
)
167+
.accessibilityHidden(true)
167168

168169
Text(name)
169170
.font(fonts.footnoteBold)
170171
.multilineTextAlignment(.center)
171172
.lineLimit(2)
172173
.frame(maxWidth: memberSize.width, maxHeight: 34, alignment: .top)
174+
.accessibilityLabel(Text(name) + Text(onlineIndicatorShown ? ", \(L10n.Message.Title.online)" : ""))
173175
}
174176
}
175177
}

Sources/StreamChatSwiftUI/Generated/L10n.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ internal enum L10n {
7676
}
7777

7878
internal enum Channel {
79+
internal enum Header {
80+
internal enum Info {
81+
/// Channel info
82+
internal static var title: String { L10n.tr("Localizable", "channel.header.info.title") }
83+
}
84+
}
7985
internal enum Item {
8086
/// Audio
8187
internal static var audio: String { L10n.tr("Localizable", "channel.item.audio") }
@@ -112,6 +118,12 @@ internal enum L10n {
112118
/// Voice Message
113119
internal static var voiceMessage: String { L10n.tr("Localizable", "channel.item.voice-message") }
114120
}
121+
internal enum List {
122+
internal enum ScrollToBottom {
123+
/// Scroll to bottom
124+
internal static var title: String { L10n.tr("Localizable", "channel.list.scroll-to-bottom.title") }
125+
}
126+
}
115127
internal enum Name {
116128
/// and
117129
internal static var and: String { L10n.tr("Localizable", "channel.name.and") }
@@ -391,8 +403,18 @@ internal enum L10n {
391403
internal static var edited: String { L10n.tr("Localizable", "message.cell.edited") }
392404
/// Pinned by
393405
internal static var pinnedBy: String { L10n.tr("Localizable", "message.cell.pinnedBy") }
406+
/// Sent at %@
407+
internal static func sentAt(_ p1: Any) -> String {
408+
return L10n.tr("Localizable", "message.cell.sent-at", String(describing: p1))
409+
}
394410
/// unknown
395411
internal static var unknownPin: String { L10n.tr("Localizable", "message.cell.unknownPin") }
412+
internal enum Read {
413+
/// Plural format key: "%#@seen@"
414+
internal static func count(_ p1: Int) -> String {
415+
return L10n.tr("Localizable", "message.cell.read.count", p1)
416+
}
417+
}
396418
}
397419
internal enum FileAttachment {
398420
/// Error occured while previewing the file.

Sources/StreamChatSwiftUI/Resources/en.lproj/Localizable.strings

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@
1818
"channel.name.direct-message" = "user";
1919
"channel.name.group" = "group";
2020

21+
"channel.list.scroll-to-bottom.title" = "Scroll to bottom";
22+
2123
"channel.no-content.title" = "Let's start chatting";
2224
"channel.no-content.message" = "How about sending your first message to a friend?";
2325
"channel.no-content.start" = "Start a chat";
2426

27+
"channel.header.info.title" = "Channel info";
28+
2529
"message.actions.inline-reply" = "Reply";
2630
"message.actions.thread-reply" = "Thread Reply";
2731
"message.actions.edit" = "Edit Message";
@@ -54,6 +58,7 @@
5458
"message.cell.pinnedBy" = "Pinned by";
5559
"message.cell.unknownPin" = "unknown";
5660
"message.cell.edited" = "Edited";
61+
"message.cell.sent-at" = "Sent at %@";
5762
"message.reactions.currentUser" = "You";
5863

5964
"message.polls.button.addComment" = "Add a Comment";

Sources/StreamChatSwiftUI/Resources/en.lproj/Localizable.stringsdict

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,5 +144,23 @@
144144
<string>%d Thread Replies</string>
145145
</dict>
146146
</dict>
147+
<key>message.cell.read.count</key>
148+
<dict>
149+
<key>NSStringLocalizedFormatKey</key>
150+
<string>%#@seen@</string>
151+
<key>seen</key>
152+
<dict>
153+
<key>NSStringFormatSpecTypeKey</key>
154+
<string>NSStringPluralRuleType</string>
155+
<key>NSStringFormatValueTypeKey</key>
156+
<string>d</string>
157+
<key>zero</key>
158+
<string>Seen by no-one</string>
159+
<key>one</key>
160+
<string>Seen by %d</string>
161+
<key>other</key>
162+
<string>Seen by %d</string>
163+
</dict>
164+
</dict>
147165
</dict>
148166
</plist>

0 commit comments

Comments
 (0)