Improve attachment upload accessibility labels

This commit is contained in:
Justin Mazzocchi 2021-03-10 21:40:33 -08:00
parent a4d2e89296
commit 20bbf5e5df
No known key found for this signature in database
GPG key ID: E223E6937AAFB01C
2 changed files with 6 additions and 1 deletions

View file

@ -98,6 +98,7 @@ final class EditAttachmentViewController: UIViewController {
textView.layer.cornerRadius = .defaultCornerRadius
textView.delegate = self
textView.text = viewModel.editingDescription
textView.accessibilityLabel = describeLabel.text
let remainingCharactersLabel = UILabel()

View file

@ -135,7 +135,6 @@ private extension AttachmentView {
addSubview(selectionButton)
selectionButton.translatesAutoresizingMaskIntoConstraints = false
selectionButton.setBackgroundImage(.highlightedButtonBackground, for: .highlighted)
selectionButton.accessibilityLabel = NSLocalizedString("compose.attachment.edit", comment: "")
selectionButton.addAction(
UIAction { [weak self] _ in
guard let self = self else { return }
@ -143,6 +142,11 @@ private extension AttachmentView {
self.parentViewModel.attachmentSelected(viewModel: self.viewModel)
},
for: .touchUpInside)
selectionButton.accessibilityLabel = NSLocalizedString("compose.attachment.edit", comment: "")
if let description = viewModel.attachment.description, !description.isEmpty {
selectionButton.accessibilityLabel?.appendWithSeparator(description)
}
addSubview(removeButton)
removeButton.translatesAutoresizingMaskIntoConstraints = false