mirror of
https://github.com/yattee/yattee.git
synced 2026-10-28 15:37:17 +00:00
Speak title, channel, and duration as the video row VoiceOver label
The row's accessibilityLabel was the debug string video.row.<id>, so VoiceOver read a raw YouTube ID for every row. Build the label from the DeArrow-aware display title, author name, and duration instead; the accessibilityIdentifier stays unchanged for UI tests.
This commit is contained in:
@@ -70,6 +70,15 @@ struct VideoRowView: View {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
private var accessibilityLabelText: String {
|
||||||
|
var parts = [video.displayTitle(using: appEnvironment?.deArrowBrandingProvider), video.author.name]
|
||||||
|
let duration = video.formattedDuration
|
||||||
|
if !duration.isEmpty {
|
||||||
|
parts.append(duration)
|
||||||
|
}
|
||||||
|
return parts.joined(separator: ", ")
|
||||||
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
HStack(alignment: .top, spacing: 12) {
|
HStack(alignment: .top, spacing: 12) {
|
||||||
// Index number (for playlists)
|
// Index number (for playlists)
|
||||||
@@ -94,7 +103,7 @@ struct VideoRowView: View {
|
|||||||
}
|
}
|
||||||
.contentShape(Rectangle())
|
.contentShape(Rectangle())
|
||||||
.accessibilityIdentifier("video.row.\(video.id.videoID)")
|
.accessibilityIdentifier("video.row.\(video.id.videoID)")
|
||||||
.accessibilityLabel("video.row.\(video.id.videoID)")
|
.accessibilityLabel(accessibilityLabelText)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
|
|||||||
Reference in New Issue
Block a user