fix: animate emoji label break VoiceOver issue

This commit is contained in:
CMK 2021-08-04 17:06:46 +08:00
parent 7806816213
commit f43b36ddda
2 changed files with 35 additions and 16 deletions

View File

@ -106,21 +106,7 @@ extension StatusSection {
) )
cell.delegate = statusTableViewCellDelegate cell.delegate = statusTableViewCellDelegate
cell.isAccessibilityElement = true cell.isAccessibilityElement = true
// FIXME: StatusSection.configureStatusAccessibilityLabel(cell: cell)
cell.accessibilityLabel = {
var accessibilityViews: [UIView?] = []
if !cell.statusView.headerContainerView.isHidden {
accessibilityViews.append(cell.statusView.headerInfoLabel)
}
accessibilityViews.append(contentsOf: [
cell.statusView.nameMetaLabel,
cell.statusView.dateLabel,
cell.statusView.contentMetaText.textView,
])
return accessibilityViews
.compactMap { $0?.accessibilityLabel }
.joined(separator: " ")
}()
return cell return cell
case .status(let objectID, let attribute), case .status(let objectID, let attribute),
.root(let objectID, let attribute), .root(let objectID, let attribute),
@ -182,7 +168,7 @@ extension StatusSection {
cell.accessibilityElements = accessibilityElements cell.accessibilityElements = accessibilityElements
default: default:
cell.isAccessibilityElement = true cell.isAccessibilityElement = true
cell.accessibilityElements = nil StatusSection.configureStatusAccessibilityLabel(cell: cell)
} }
return cell return cell
case .leafBottomLoader: case .leafBottomLoader:
@ -1117,6 +1103,25 @@ extension StatusSection {
self.setupStatusMoreButtonMenu(cell: cell, dependency: dependency, status: status) self.setupStatusMoreButtonMenu(cell: cell, dependency: dependency, status: status)
} }
static func configureStatusAccessibilityLabel(cell: StatusTableViewCell) {
// FIXME:
cell.accessibilityLabel = {
var accessibilityViews: [UIView?] = []
if !cell.statusView.headerContainerView.isHidden {
accessibilityViews.append(cell.statusView.headerInfoLabel)
}
accessibilityViews.append(contentsOf: [
cell.statusView.nameMetaLabel,
cell.statusView.dateLabel,
cell.statusView.contentMetaText.textView,
])
return accessibilityViews
.compactMap { $0?.accessibilityLabel }
.joined(separator: " ")
}()
cell.statusView.actionToolbarContainer.isUserInteractionEnabled = !UIAccessibility.isVoiceOverRunning
}
} }

View File

@ -62,6 +62,20 @@ class AppearanceView: UIView {
titleLabel.text = title titleLabel.text = title
} }
override var isAccessibilityElement: Bool {
get { return true }
set { }
}
override var accessibilityLabel: String? {
get {
return [titleLabel.text, checkBox.accessibilityLabel]
.compactMap { $0 }
.joined(separator: ", ")
}
set { }
}
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }