From 8e58478290eeefede4fcc92e961c173a3062c4e0 Mon Sep 17 00:00:00 2001 From: CMK Date: Thu, 1 Jul 2021 20:23:36 +0800 Subject: [PATCH] fix: workaround text view not read in voice over issue --- Mastodon/Diffiable/Section/StatusSection.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Mastodon/Diffiable/Section/StatusSection.swift b/Mastodon/Diffiable/Section/StatusSection.swift index ce9f07ae0..dd244eba0 100644 --- a/Mastodon/Diffiable/Section/StatusSection.swift +++ b/Mastodon/Diffiable/Section/StatusSection.swift @@ -99,6 +99,17 @@ extension StatusSection { ) cell.delegate = statusTableViewCellDelegate cell.isAccessibilityElement = true + // FIXME: + cell.accessibilityLabel = { + [ + cell.statusView.headerInfoLabel.accessibilityLabel, + cell.statusView.nameLabel.accessibilityLabel, + cell.statusView.dateLabel.accessibilityLabel, + cell.statusView.contentMetaText.textView.accessibilityLabel, + ] + .compactMap { $0 } + .joined(separator: " ") + }() return cell case .status(let objectID, let attribute), .root(let objectID, let attribute), @@ -566,11 +577,15 @@ extension StatusSection { ) let metaContent = try MastodonMetaContent.convert(document: content) cell.statusView.contentMetaText.configure(content: metaContent) + cell.statusView.contentMetaText.textView.accessibilityLabel = metaContent.trimmed } catch { cell.statusView.contentMetaText.textView.text = " " + cell.statusView.contentMetaText.textView.accessibilityLabel = "" assertionFailure() } + cell.statusView.contentMetaText.textView.accessibilityTraits = [.staticText] + cell.statusView.contentMetaText.textView.accessibilityElementsHidden = false cell.statusView.contentMetaText.textView.accessibilityLanguage = (status.reblog ?? status).language // set visibility