From c1b4cfec4f728ea8ea6c70cd0eaead7e7617f7c7 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Thu, 26 Feb 2026 11:35:17 -0800 Subject: [PATCH] Remove "optional" from accessibility feed label. Make sure subviews are not accessibility elements. --- .../MainFeedCollectionHeaderReusableView.swift | 4 ++++ .../MainFeedCollectionViewCell.swift | 9 +++++++-- .../MainFeedCollectionViewFolderCell.swift | 10 ++++++++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/iOS/MainFeed/Collection View Cells/MainFeedCollectionHeaderReusableView.swift b/iOS/MainFeed/Collection View Cells/MainFeedCollectionHeaderReusableView.swift index fa194f7d2..1bc186257 100644 --- a/iOS/MainFeed/Collection View Cells/MainFeedCollectionHeaderReusableView.swift +++ b/iOS/MainFeed/Collection View Cells/MainFeedCollectionHeaderReusableView.swift @@ -70,6 +70,10 @@ final class MainFeedCollectionHeaderReusableView: UICollectionReusableView { override func awakeFromNib() { MainActor.assumeIsolated { super.awakeFromNib() + isAccessibilityElement = true + headerTitle.isAccessibilityElement = false + unreadCountLabel.isAccessibilityElement = false + disclosureIndicator.isAccessibilityElement = false unreadLabelWidthConstraint = unreadCountLabel.widthAnchor.constraint(lessThanOrEqualToConstant: 80) unreadLabelWidthConstraint?.isActive = true configureUI() diff --git a/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewCell.swift b/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewCell.swift index eaf8b2aeb..d3dec1474 100644 --- a/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewCell.swift +++ b/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewCell.swift @@ -62,11 +62,12 @@ final class MainFeedCollectionViewCell: UICollectionViewCell { override var accessibilityLabel: String? { get { + let name = feedTitle.text ?? "" if unreadCount > 0 { let unreadLabel = NSLocalizedString("unread", comment: "Unread label for accessibility") - return "\(String(describing: feedTitle.text)) \(unreadCount) \(unreadLabel)" + return "\(name) \(unreadCount) \(unreadLabel)" } else { - return (String(describing: feedTitle.text)) + return name } } set {} @@ -75,6 +76,10 @@ final class MainFeedCollectionViewCell: UICollectionViewCell { override func awakeFromNib() { MainActor.assumeIsolated { super.awakeFromNib() + isAccessibilityElement = true + feedTitle.isAccessibilityElement = false + unreadCountLabel.isAccessibilityElement = false + faviconView.isAccessibilityElement = false faviconLeadingConstraint = faviconView.leadingAnchor.constraint(equalTo: contentView.safeAreaLayoutGuide.leadingAnchor) faviconLeadingConstraint?.isActive = true } diff --git a/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewFolderCell.swift b/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewFolderCell.swift index 414e0fe69..26c5fc6f5 100644 --- a/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewFolderCell.swift +++ b/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewFolderCell.swift @@ -58,6 +58,11 @@ class MainFeedCollectionViewFolderCell: UICollectionViewCell { override func awakeFromNib() { MainActor.assumeIsolated { super.awakeFromNib() + isAccessibilityElement = true + folderTitle.isAccessibilityElement = false + unreadCountLabel.isAccessibilityElement = false + faviconView.isAccessibilityElement = false + disclosureButton.isAccessibilityElement = false disclosureButton.addInteraction(UIPointerInteraction()) } } @@ -99,11 +104,12 @@ class MainFeedCollectionViewFolderCell: UICollectionViewCell { override var accessibilityLabel: String? { get { + let name = folderTitle.text ?? "" if unreadCount > 0 { let unreadLabel = NSLocalizedString("unread", comment: "Unread label for accessibility") - return "\(String(describing: folderTitle.text)) \(unreadCount) \(unreadLabel)" + return "\(name) \(unreadCount) \(unreadLabel)" } else { - return (String(describing: folderTitle.text)) + return name } } set {}