Fix a11y for title view of timeline view controller

This commit is contained in:
Rizwan Mohamed Ibrahim 2020-07-29 11:37:27 +05:30
parent 18fd984246
commit 1c4b6b4c26
No known key found for this signature in database
GPG Key ID: D5BEE468D448BCC5
1 changed files with 15 additions and 1 deletions

View File

@ -18,7 +18,20 @@ class MasterTimelineTitleView: UIView {
private lazy var pointerInteraction: UIPointerInteraction = { private lazy var pointerInteraction: UIPointerInteraction = {
UIPointerInteraction(delegate: self) UIPointerInteraction(delegate: self)
}() }()
override var accessibilityLabel: String? {
set { }
get {
if let name = label.text {
let unreadLabel = NSLocalizedString("unread", comment: "Unread label for accessiblity")
return "\(name) \(unreadCountView.unreadCount) \(unreadLabel)"
}
else {
return nil
}
}
}
func buttonize() { func buttonize() {
heightAnchor.constraint(equalToConstant: 40.0).isActive = true heightAnchor.constraint(equalToConstant: 40.0).isActive = true
accessibilityTraits = .button accessibilityTraits = .button
@ -28,6 +41,7 @@ class MasterTimelineTitleView: UIView {
} }
func debuttonize() { func debuttonize() {
heightAnchor.constraint(equalToConstant: 40.0).isActive = true
accessibilityTraits.remove(.button) accessibilityTraits.remove(.button)
if #available(iOS 13.4, *) { if #available(iOS 13.4, *) {
removeInteraction(pointerInteraction) removeInteraction(pointerInteraction)