Skip to content

Commit

Permalink
add accessibility label for •••
Browse files Browse the repository at this point in the history
we use "•••" to indicate "other" reactions visually,
however, when visually impaired, eg. screen readers won't have a clue.

therefore, set accessibilityLabel to "Other".

for the other reactions, things might be good enough,
at least, voice over has a chance to read this out in its meaning.
if we get concrete feedback, we'll try to improve.
  • Loading branch information
r10s committed Apr 20, 2024
1 parent 427fe15 commit 8def68c
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions deltachat-ios/Chat/ChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1957,34 +1957,37 @@ extension ChatViewController {

let showPicker = myReactions.isEmpty || myReactionChecked
let title: String
let accessibilityLabel: String?
if showPicker {
title = "•••"
accessibilityLabel = String.localized("pref_other")
} else {
title = (myReactions.first ?? "?") + ""
accessibilityLabel = nil
}
menuElements.append(
UIAction(title: title) { [weak self] _ in
guard let self else { return }
let messageId = self.messageIds[indexPath.row]
if showPicker {
reactionMessageId = messageId
let pickerViewController = MCEmojiPickerViewController()
pickerViewController.navigationItem.title = String.localized("react")
pickerViewController.delegate = self

let navigationController = UINavigationController(rootViewController: pickerViewController)
if #available(iOS 15.0, *) {
if let sheet = navigationController.sheetPresentationController {
sheet.detents = [.medium(), .large()]
sheet.preferredCornerRadius = 20
}
let action = UIAction(title: title) { [weak self] _ in
guard let self else { return }
let messageId = self.messageIds[indexPath.row]
if showPicker {
reactionMessageId = messageId
let pickerViewController = MCEmojiPickerViewController()
pickerViewController.navigationItem.title = String.localized("react")
pickerViewController.delegate = self

let navigationController = UINavigationController(rootViewController: pickerViewController)
if #available(iOS 15.0, *) {
if let sheet = navigationController.sheetPresentationController {
sheet.detents = [.medium(), .large()]
sheet.preferredCornerRadius = 20
}
present(navigationController, animated: true)
} else {
dcContext.sendReaction(messageId: messageId, reaction: nil)
}
present(navigationController, animated: true)
} else {
dcContext.sendReaction(messageId: messageId, reaction: nil)
}
)
}
action.accessibilityLabel = accessibilityLabel
menuElements.append(action)
}

// context menu for iOS 13+
Expand Down

0 comments on commit 8def68c

Please sign in to comment.