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.isAccessibilityElement = true
// 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: " ")
}()
StatusSection.configureStatusAccessibilityLabel(cell: cell)
return cell
case .status(let objectID, let attribute),
.root(let objectID, let attribute),
@ -182,7 +168,7 @@ extension StatusSection {
cell.accessibilityElements = accessibilityElements
default:
cell.isAccessibilityElement = true
cell.accessibilityElements = nil
StatusSection.configureStatusAccessibilityLabel(cell: cell)
}
return cell
case .leafBottomLoader:
@ -1116,6 +1102,25 @@ extension StatusSection {
.store(in: &cell.disposeBag)
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

@ -61,6 +61,20 @@ class AppearanceView: UIView {
imageView.image = image
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) {
fatalError("init(coder:) has not been implemented")