Merge pull request #2263 from rizwankce/fix/a11y

Fix/a11y
This commit is contained in:
Maurice Parker 2020-07-14 13:47:19 -05:00 committed by GitHub
commit be6a786961
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 4 deletions

View File

@ -21,12 +21,22 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView {
get { get {
if unreadCount > 0 { if unreadCount > 0 {
let unreadLabel = NSLocalizedString("unread", comment: "Unread label for accessiblity") let unreadLabel = NSLocalizedString("unread", comment: "Unread label for accessiblity")
return "\(name) \(unreadCount) \(unreadLabel)" return "\(name) \(unreadCount) \(unreadLabel) \(expandedStateMessage) "
} else { } else {
return name return "\(name) \(expandedStateMessage) "
} }
} }
} }
private var expandedStateMessage: String {
set {}
get {
if disclosureExpanded {
return NSLocalizedString("Expanded", comment: "Disclosure button expanded state for accessibility")
}
return NSLocalizedString("Collapsed", comment: "Disclosure button collapsed state for accessibility")
}
}
var unreadCount: Int { var unreadCount: Int {
get { get {

View File

@ -237,8 +237,9 @@ private extension MasterTimelineTableViewCell {
} }
func updateAccessiblityLabel() { func updateAccessiblityLabel() {
var label = cellData.read ? "" : "\(NSLocalizedString("Unread", comment: "Unread")), " let starredStatus = cellData.starred ? "\(NSLocalizedString("Starred", comment: "Starred article for accessibility")), " : ""
label += "\(cellData.feedName), \(cellData.title), \(cellData.summary), \(cellData.dateString)" let unreadStatus = cellData.read ? "" : "\(NSLocalizedString("Unread", comment: "Unread")), "
let label = starredStatus + unreadStatus + "\(cellData.feedName), \(cellData.title), \(cellData.summary), \(cellData.dateString)"
accessibilityLabel = label accessibilityLabel = label
} }