Skip to content

Commit 2842e6e

Browse files
authored
Merge pull request #17807 from wordpress-mobile/issue/12878-media-detail-improve-accessibility
Media Detail screen improve accessibility and hints
2 parents e3f2934 + 4e34396 commit 2842e6e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

WordPress/Classes/Utility/WPImmuTableRows.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ struct EditableTextRow: ImmuTableRow {
9393
func configureCell(_ cell: UITableViewCell) {
9494
cell.textLabel?.text = title
9595
cell.detailTextLabel?.text = value
96+
cell.accessibilityLabel = title
97+
cell.accessibilityValue = value
98+
if cell.isUserInteractionEnabled {
99+
cell.accessibilityHint = NSLocalizedString("Tap to edit", comment: "Accessibility hint prompting the user to tap a table row to edit its value.")
100+
}
96101
cell.accessoryType = .disclosureIndicator
97102
if accessoryImage != nil {
98103
cell.accessoryView = UIImageView(image: accessoryImage)
@@ -129,6 +134,9 @@ struct TextRow: ImmuTableRow {
129134
func configureCell(_ cell: UITableViewCell) {
130135
cell.textLabel?.text = title
131136
cell.detailTextLabel?.text = value
137+
cell.accessibilityLabel = title
138+
cell.accessibilityValue = value
139+
132140
cell.selectionStyle = .none
133141

134142
WPStyleGuide.configureTableViewCell(cell)

WordPress/Classes/ViewRelated/Cells/MediaItemTableViewCells.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ struct MediaImageRow: ImmuTableRow {
175175
setAspectRatioFor(cell)
176176
loadImageFor(cell)
177177
cell.isVideo = media.mediaType == .video
178+
cell.accessibilityTraits = .button
179+
cell.accessibilityLabel = NSLocalizedString("Preview media", comment: "Accessibility label for media item preview for user's viewing an item in their media library")
180+
cell.accessibilityHint = NSLocalizedString("Tap to view media in full screen", comment: "Accessibility hint for media item preview for user's viewing an item in their media library")
178181
}
179182
}
180183

@@ -239,6 +242,9 @@ struct MediaDocumentRow: ImmuTableRow {
239242
if let cell = cell as? MediaItemDocumentTableViewCell {
240243
cell.customImageView.tintColor = cell.textLabel?.textColor
241244
cell.showIconForMedia(media)
245+
cell.accessibilityTraits = .button
246+
cell.accessibilityLabel = NSLocalizedString("Preview media", comment: "Accessibility label for media item preview for user's viewing an item in their media library")
247+
cell.accessibilityHint = NSLocalizedString("Tap to view media in full screen", comment: "Accessibility hint for media item preview for user's viewing an item in their media library")
242248
}
243249
}
244250
}

0 commit comments

Comments
 (0)