Skip to content

Commit 1ceac73

Browse files
authored
Improve voice over labels and actions (#726)
* Improve voice over labels and navigation * Numerous label fixes, image removals, and actions * Fix UI-tests caused by adding accessibility actions which changes elements to buttons
1 parent 9557751 commit 1ceac73

23 files changed

+127
-4
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
55

66
### 🐞 Fixed
77
- Fix thread reply action shown when inside a Thread [#717](https://github.com/GetStream/stream-chat-swiftui/pull/717)
8+
- Improve voice over by adding missing labels, removing decorative images, and setting accessibility actions [#726](https://github.com/GetStream/stream-chat-swiftui/pull/726)
89
### 🔄 Changed
910
- Deprecate unused `ChatMessage.userDisplayInfo(from:)` which only accessed cached data [#718](https://github.com/GetStream/stream-chat-swiftui/pull/718)
11+
### 🎭 New Localizations
12+
Add localizable keys for supporting accessibility labels:
13+
- `channel.list.scroll-to-bottom.title`
14+
- `channel.header.info.title`
15+
- `message.attachment.accessibility-label`
16+
- `message.read-status.seen-by*`
17+
- `message.cell.sent-at`
18+
- `composer.picker.show-all`
19+
- `composer.audio-recording.*`
1020

1121
# [4.70.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.70.0)
1222
_January 15, 2025_

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/ChannelInfo/ChatChannelInfoView.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ public struct ChatChannelInfoView: View, KeyboardReadable {
112112
.onTapGesture {
113113
viewModel.addUsersShown = false
114114
}
115+
.accessibilityAction {
116+
viewModel.addUsersShown = false
117+
}
115118
AddUsersView(
116119
loadedUserIds: viewModel.participants.map(\.id),
117120
onUserTap: viewModel.addUserTapped(_:)

Sources/StreamChatSwiftUI/ChatChannel/Composer/AttachmentPickerTypeView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public struct AttachmentPickerTypeView: View {
5656
pickerType: .media,
5757
selected: attachmentPickerType
5858
)
59+
.accessibilityLabel(Text(L10n.Composer.Picker.showAll))
5960
.accessibilityIdentifier("PickerTypeButtonMedia")
6061
}
6162

@@ -65,6 +66,7 @@ public struct AttachmentPickerTypeView: View {
6566
pickerType: .instantCommands,
6667
selected: attachmentPickerType
6768
)
69+
.accessibilityLabel(Text(L10n.Composer.Suggestions.Commands.header))
6870
.accessibilityIdentifier("PickerTypeButtonCommands")
6971
}
7072
case .collapsed:

Sources/StreamChatSwiftUI/ChatChannel/Composer/AttachmentPickerView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ public struct AttachmentSourcePickerView: View {
159159
isSelected: selected == .files,
160160
onTap: onTap
161161
)
162+
.accessibilityLabel(L10n.Composer.Picker.file)
162163
.accessibilityIdentifier("attachmentPickerFiles")
163164

164165
AttachmentPickerButton(
@@ -176,6 +177,7 @@ public struct AttachmentSourcePickerView: View {
176177
isSelected: selected == .polls,
177178
onTap: onTap
178179
)
180+
.accessibilityLabel(L10n.Composer.Polls.createPoll)
179181
.accessibilityIdentifier("attachmentPickerPolls")
180182
}
181183

Sources/StreamChatSwiftUI/ChatChannel/Composer/SendMessageButton.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public struct SendMessageButton: View {
3131
)
3232
}
3333
.disabled(!enabled)
34-
.accessibilityAddTraits(.isButton)
34+
.accessibilityLabel(Text(L10n.Composer.Placeholder.message))
3535
.accessibilityIdentifier("SendMessageButton")
3636
}
3737

Sources/StreamChatSwiftUI/ChatChannel/Composer/TrailingComposerView.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,12 @@ public struct VoiceRecordingButton: View {
8585
}
8686
}
8787
)
88+
.accessibilityRemoveTraits(.isImage)
89+
.accessibilityAddTraits(.isButton)
90+
.accessibilityLabel(Text(L10n.Composer.AudioRecording.start))
91+
.accessibilityAction {
92+
viewModel.recordingState = .recording(.zero)
93+
viewModel.startRecording()
94+
}
8895
}
8996
}

Sources/StreamChatSwiftUI/ChatChannel/Composer/VoiceRecording/RecordingView.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ struct RecordingView: View {
2020
HStack {
2121
Image(systemName: "mic")
2222
.foregroundColor(.red)
23+
.accessibilityHidden(true)
2324
RecordingDurationView(duration: audioRecordingInfo.duration)
2425

2526
Spacer()
@@ -30,6 +31,7 @@ struct RecordingView: View {
3031
}
3132
.foregroundColor(Color(colors.textLowEmphasis))
3233
.opacity(opacityForSlideToCancel)
34+
.accessibilityHidden(true)
3335

3436
Spacer()
3537

@@ -38,6 +40,7 @@ struct RecordingView: View {
3840
} label: {
3941
Image(systemName: "mic")
4042
}
43+
.accessibilityLabel(Text(L10n.Composer.AudioRecording.stop))
4144
}
4245
.padding(.all, 12)
4346
.overlay(

Sources/StreamChatSwiftUI/ChatChannel/MessageList/AsyncVoiceMessages/VoiceRecordingContainerView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ struct VoiceRecordingView: View {
215215
.resizable()
216216
.aspectRatio(contentMode: .fit)
217217
.frame(height: 40)
218+
.accessibilityHidden(true)
218219
}
219220
}
220221
.onReceive(handler.$context, perform: { value in

0 commit comments

Comments
 (0)