From 8de3353b578bd89d3373c232b1209b60f4a8f5b2 Mon Sep 17 00:00:00 2001 From: Amit Raj Date: Thu, 13 Aug 2026 15:34:23 +0530 Subject: [PATCH] Announce selected post categories to VoiceOver The category rows showed selection only through a checkmark image, which carries no accessibility information. VoiceOver read the same thing for a selected and an unselected category, so the state was conveyed by sight only. Make the cell one accessibility element and give it the selected trait when the category is picked. The state is not added to the label text, so nothing new needs translating. Fixes #25737 --- RELEASE-NOTES.txt | 1 + .../Categories/PostCategoriesViewController.swift | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index ce6c64879123..7f2a9d817a3e 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -3,6 +3,7 @@ * [*] Custom Post Types: Make custom post types with REST API and editor support available in My Site [#25849] * [*] Stop the media picker from removing gallery images when you cancel it in the experimental editor [#25866] * [*] Stats: Fix the screen getting stuck on a loading indicator for self-hosted sites that are not connected to Jetpack [#25858] +* [*] Accessibility: VoiceOver now announces which post categories are selected [#25737] 27.1 ----- diff --git a/WordPress/Classes/ViewRelated/Post/Categories/PostCategoriesViewController.swift b/WordPress/Classes/ViewRelated/Post/Categories/PostCategoriesViewController.swift index c05ff1ed6544..305d1ae99452 100644 --- a/WordPress/Classes/ViewRelated/Post/Categories/PostCategoriesViewController.swift +++ b/WordPress/Classes/ViewRelated/Post/Categories/PostCategoriesViewController.swift @@ -178,9 +178,20 @@ import WordPressUI let indentationLevel = categoryIndentationDict[category.categoryID.intValue] cell.indentationLevel = indentationLevel ?? 0 cell.indentationWidth = Constants.categoryCellIndentation - cell.textLabel?.text = category.categoryName.stringByDecodingXMLCharacters() + let title = category.categoryName.stringByDecodingXMLCharacters() + cell.textLabel?.text = title WPStyleGuide.configureTableViewCell(cell) - cell.accessoryView = makeAccessoryView(isSelected: selectedCategories.contains(category)) + + let isSelected = selectedCategories.contains(category) + cell.accessoryView = makeAccessoryView(isSelected: isSelected) + + // The checkmark is drawn in an image view, which carries no accessibility + // information, so selected and unselected rows were indistinguishable. + // Make the cell a single element and let the trait carry the state, rather + // than appending "selected" to the label. + cell.isAccessibilityElement = true + cell.accessibilityLabel = title + cell.accessibilityTraits = isSelected ? [.selected] : [] } private func makeAccessoryView(isSelected: Bool) -> UIView {