Skip to content

Commit f72d4ee

Browse files
committed
Numerous label fixes, image removals, and actions
1 parent 8e39831 commit f72d4ee

File tree

17 files changed

+73
-28
lines changed

17 files changed

+73
-28
lines changed

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

Sources/StreamChatSwiftUI/ChatChannel/MessageList/FileAttachmentView.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ public struct FileAttachmentView: View {
9797
.onTapGesture {
9898
fullScreenShown = true
9999
}
100+
.accessibilityAction {
101+
fullScreenShown = true
102+
}
100103

101104
Spacer()
102105
}
@@ -134,6 +137,7 @@ public struct FileAttachmentDisplayView: View {
134137
.resizable()
135138
.aspectRatio(contentMode: .fit)
136139
.frame(width: 34, height: 40)
140+
.accessibilityHidden(true)
137141
VStack(alignment: .leading, spacing: 8) {
138142
Text(title)
139143
.font(fonts.bodyBold)

Sources/StreamChatSwiftUI/ChatChannel/MessageList/GiphyBadgeView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public struct GiphyBadgeView: View {
1414
BottomLeftView {
1515
HStack(spacing: 4) {
1616
Image(uiImage: images.commandGiphy)
17+
.accessibilityHidden(true)
1718
Text(L10n.Message.GiphyAttachment.title)
1819
.font(fonts.bodyBold)
1920
.foregroundColor(Color(colors.staticColorText))

Sources/StreamChatSwiftUI/ChatChannel/MessageList/ImageAttachmentView.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,11 @@ struct LazyLoadingImage: View {
371371
imageTapped(index ?? 0)
372372
}
373373
)
374+
.accessibilityLabel(L10n.Message.Attachment.accessibilityLabel((index ?? 0) + 1))
375+
.accessibilityAddTraits(source.type == .video ? .startsMediaSession : .isImage)
376+
.accessibilityAction {
377+
imageTapped(index ?? 0)
378+
}
374379
}
375380
} else if error != nil {
376381
Color(.secondarySystemBackground)
@@ -383,6 +388,7 @@ struct LazyLoadingImage: View {
383388

384389
if source.type == .video && width > 64 && source.uploadingState == nil {
385390
VideoPlayIcon()
391+
.accessibilityHidden(true)
386392
}
387393
}
388394
.onAppear {
@@ -414,6 +420,7 @@ struct LazyLoadingImage: View {
414420
.allowsHitTesting(false)
415421
.scaleEffect(1.0001) // Needed because of SwiftUI sometimes incorrectly displaying landscape images.
416422
.clipped()
423+
.accessibilityHidden(true)
417424
}
418425
}
419426

0 commit comments

Comments
 (0)