-
Notifications
You must be signed in to change notification settings - Fork 382
Improve accessibility of more options button and notification cell #119
Conversation
…abels This makes the cell an accessibility element (eg. Review GitHub Access under Settings) and mention that A: the cell is a button and B: its label is "Review GitHub Access" Before this change, the label was an element and did not mention it was also a button
@@ -98,6 +100,10 @@ final class NotificationCell: SwipeSelectableCell { | |||
textLabel.attributedText = viewModel.title.attributedText | |||
dateLabel.setText(date: viewModel.date) | |||
reasonImageView.image = viewModel.type.icon?.withRenderingMode(.alwaysTemplate) | |||
accessibilityLabel = contentView.subviews | |||
.flatMap { $0.accessibilityLabel } | |||
.reduce("", { $0 + ".\n" + $1 }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the ./n
-s makes VoiceOver read these as sentences instead of just one, long sentence, making the different labels / elements separated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same note about moving this to override?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the comment on the other one:
That would be a little restricting though - we can't access the
viewModel
in theNotificationCell
, which I used to provide the type (Issue / PR / commit).
Classes/Views/SelectableCell.swift
Outdated
@@ -47,6 +57,9 @@ class SelectableCell: UICollectionViewCell { | |||
|
|||
override func layoutSubviews() { | |||
super.layoutSubviews() | |||
accessibilityLabel = contentView.subviews | |||
.flatMap { $0.accessibilityLabel } | |||
.reduce("", { "\($0 ?? "").\n\($1)" }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind moving this to an override of accessibilityLabel
? Then it only executes when necessary instead of every layout pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be a little restricting though - we can't access the viewModel
in the NotificationCell
, which I used to provide the type (Issue / PR / commit).
@@ -98,6 +100,10 @@ final class NotificationCell: SwipeSelectableCell { | |||
textLabel.attributedText = viewModel.title.attributedText | |||
dateLabel.setText(date: viewModel.date) | |||
reasonImageView.image = viewModel.type.icon?.withRenderingMode(.alwaysTemplate) | |||
accessibilityLabel = contentView.subviews | |||
.flatMap { $0.accessibilityLabel } | |||
.reduce("", { $0 + ".\n" + $1 }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same note about moving this to override?
SO GOOD, I love it |
…reetime into improve-accessibility
Ref #118
This PR: