From 8def68c6038cd48edd5db326f736492ec0f12b44 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Mon, 8 Apr 2024 16:49:58 +0200 Subject: [PATCH] =?UTF-8?q?add=20accessibility=20label=20for=20=E2=80=A2?= =?UTF-8?q?=E2=80=A2=E2=80=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- deltachat-ios/Chat/ChatViewController.swift | 43 +++++++++++---------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/deltachat-ios/Chat/ChatViewController.swift b/deltachat-ios/Chat/ChatViewController.swift index 41a989218..775f4b0e7 100644 --- a/deltachat-ios/Chat/ChatViewController.swift +++ b/deltachat-ios/Chat/ChatViewController.swift @@ -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+