Make status attachments VoiceOver accessible
This commit is contained in:
parent
fbc5d6eed9
commit
f54d4d757f
|
@ -75,6 +75,9 @@ class AttachmentView: UIImageView, GIFAnimatable {
|
|||
NotificationCenter.default.addObserver(self, selector: #selector(gifPlaybackModeChanged), name: .NSProcessInfoPowerStateDidChange, object: nil)
|
||||
|
||||
addInteraction(UIContextMenuInteraction(delegate: self))
|
||||
|
||||
isAccessibilityElement = true
|
||||
accessibilityTraits = [.image, .button]
|
||||
}
|
||||
|
||||
@objc private func preferencesChanged() {
|
||||
|
@ -293,6 +296,13 @@ class AttachmentView: UIImageView, GIFAnimatable {
|
|||
@objc func imagePressed() {
|
||||
showGallery()
|
||||
}
|
||||
|
||||
// MARK: - Accessibility
|
||||
|
||||
override func accessibilityActivate() -> Bool {
|
||||
showGallery()
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -248,9 +248,11 @@ class AttachmentsContainerView: UIView {
|
|||
let attachmentView = AttachmentView(attachment: attachments[index], index: index, expectedSize: size)
|
||||
attachmentView.delegate = delegate
|
||||
attachmentView.translatesAutoresizingMaskIntoConstraints = false
|
||||
attachmentView.isAccessibilityElement = true
|
||||
attachmentView.accessibilityTraits = [.image, .button]
|
||||
attachmentView.accessibilityLabel = String(format: NSLocalizedString("Attachment %d", comment: "attachment at index accessiblity label"), index + 1)
|
||||
attachmentView.accessibilityLabel = "Attachment \(index + 1)"
|
||||
if let desc = attachments[index].description {
|
||||
attachmentView.accessibilityLabel! += ", \(desc)"
|
||||
}
|
||||
attachmentViews.add(attachmentView)
|
||||
return attachmentView
|
||||
}
|
||||
|
|
|
@ -95,7 +95,6 @@ class BaseStatusTableViewCell: UITableViewCell, MenuPreviewProvider {
|
|||
collapseButton.layer.cornerRadius = 5
|
||||
|
||||
accessibilityElements = [displayNameLabel!, contentWarningLabel!, collapseButton!, contentTextView!, attachmentsView!, pollView!]
|
||||
attachmentsView.isAccessibilityElement = true
|
||||
|
||||
moreButton.showsMenuAsPrimaryAction = true
|
||||
|
||||
|
@ -157,8 +156,6 @@ class BaseStatusTableViewCell: UITableViewCell, MenuPreviewProvider {
|
|||
cardView.navigationDelegate = navigationDelegate
|
||||
|
||||
attachmentsView.updateUI(status: status)
|
||||
attachmentsView.isAccessibilityElement = status.attachments.count > 0
|
||||
attachmentsView.accessibilityLabel = String(format: NSLocalizedString("%d attachments", comment: "status attachments count accessibility label"), status.attachments.count)
|
||||
|
||||
updateStatusState(status: status)
|
||||
|
||||
|
|
|
@ -219,6 +219,11 @@ class TimelineStatusTableViewCell: BaseStatusTableViewCell {
|
|||
}
|
||||
set {}
|
||||
}
|
||||
|
||||
override func accessibilityActivate() -> Bool {
|
||||
didSelectCell()
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue