From 1c4b6b4c260812ac27f6525b7bf216da2606ba45 Mon Sep 17 00:00:00 2001 From: Rizwan Mohamed Ibrahim Date: Wed, 29 Jul 2020 11:37:27 +0530 Subject: [PATCH] Fix a11y for title view of timeline view controller --- iOS/MasterTimeline/MasterTimelineTitleView.swift | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/iOS/MasterTimeline/MasterTimelineTitleView.swift b/iOS/MasterTimeline/MasterTimelineTitleView.swift index 76e4fbbaa..9c81ac7ee 100644 --- a/iOS/MasterTimeline/MasterTimelineTitleView.swift +++ b/iOS/MasterTimeline/MasterTimelineTitleView.swift @@ -18,7 +18,20 @@ class MasterTimelineTitleView: UIView { private lazy var pointerInteraction: UIPointerInteraction = { 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() { heightAnchor.constraint(equalToConstant: 40.0).isActive = true accessibilityTraits = .button @@ -28,6 +41,7 @@ class MasterTimelineTitleView: UIView { } func debuttonize() { + heightAnchor.constraint(equalToConstant: 40.0).isActive = true accessibilityTraits.remove(.button) if #available(iOS 13.4, *) { removeInteraction(pointerInteraction)