From 60767c6a7eb821661f428d5797256059f1da8273 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Tue, 6 Dec 2022 21:54:17 -0500 Subject: [PATCH] Profile Directory screen VoiceOver improvements Add label to filter button (and change icon to match other filters) Make each profile a single accessibility element --- .../FeaturedProfileCollectionViewCell.swift | 21 ++++++++++++++++++- .../ProfileDirectoryViewController.swift | 5 +++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Tusker/Screens/Explore/FeaturedProfileCollectionViewCell.swift b/Tusker/Screens/Explore/FeaturedProfileCollectionViewCell.swift index 589b097b..a1013c37 100644 --- a/Tusker/Screens/Explore/FeaturedProfileCollectionViewCell.swift +++ b/Tusker/Screens/Explore/FeaturedProfileCollectionViewCell.swift @@ -122,5 +122,24 @@ class FeaturedProfileCollectionViewCell: UICollectionViewCell { displayNameLabel.updateForAccountDisplayName(account: account) } } - + + // MARK: Accessibility + + override var isAccessibilityElement: Bool { + get { true } + set {} + } + + override var accessibilityAttributedLabel: NSAttributedString? { + get { + guard let account else { + return nil + } + let s = NSMutableAttributedString(string: "\(account.displayName), ") + s.append(noteTextView.attributedText) + return s + } + set {} + } + } diff --git a/Tusker/Screens/Explore/ProfileDirectoryViewController.swift b/Tusker/Screens/Explore/ProfileDirectoryViewController.swift index 95dac999..2bb792f5 100644 --- a/Tusker/Screens/Explore/ProfileDirectoryViewController.swift +++ b/Tusker/Screens/Explore/ProfileDirectoryViewController.swift @@ -34,8 +34,9 @@ class ProfileDirectoryViewController: UIViewController { title = NSLocalizedString("Profile Directory", comment: "profile directory title") - // todo: it would be nice if there were a better "filter" icon - navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(systemName: "scope"), menu: nil) + let filterItem = UIBarButtonItem(image: UIImage(systemName: "line.3.horizontal.decrease.circle"), menu: nil) + filterItem.accessibilityLabel = "Filter" + navigationItem.rightBarButtonItem = filterItem updateFilterMenu() let layout = UICollectionViewCompositionalLayout(sectionProvider: { (sectionIndex, layoutEnvironment) in