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.layer.cornerRadius = .defaultCornerRadius
textView.delegate = self textView.delegate = self
textView.text = viewModel.editingDescription textView.text = viewModel.editingDescription
textView.accessibilityLabel = describeLabel.text
let remainingCharactersLabel = UILabel() let remainingCharactersLabel = UILabel()

View file

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