Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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] : []

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "no category" cell (see configureNoCategoryRow) reuses the same cell instances, which need to be updated in the same way as here too.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I think you'd need to update the "didSelectRow" function, too? didSelectRow only updates accessoryView, but not the accessibility data.

I think it may make sense to have one single function for updating accessibility based on the cell state?

}

private func makeAccessoryView(isSelected: Bool) -> UIView {
Expand Down