VoiceOver: add accessibilityLabel to Posts Lists' add & view buttons#13038
VoiceOver: add accessibilityLabel to Posts Lists' add & view buttons#13038vphong wants to merge 1 commit intowordpress-mobile:developfrom
accessibilityLabel to Posts Lists' add & view buttons#13038Conversation
| } | ||
|
|
||
| func configureNavigationButtons() { | ||
| addButton.accessibilityLabel = "Add new post" |
There was a problem hiding this comment.
I think a better place for this would be the addButton's initializer in here:
In this way, we can also fix the same problem in the Pages List.
The label can also just be “Add”. There is enough context on the page that the user should be able to figure out that “Add” means adding a new post or adding a new page. You can read more about this in the Guidelines for creating labels.
Lastly, strings should be localized. Using NSLocalizedString should be enough. The translation will be handled during the release process. Please feel free to poke around in the codebase for some examples. 🙂
- Move to the
addButtoninitializer - Use
NSLocalizedString - Shorten to
"Add"
|
|
||
| func configureNavigationButtons() { | ||
| addButton.accessibilityLabel = "Add new post" | ||
| postsViewButtonItem.accessibilityLabel = isCompact ? "Switch to expanded list view" : "Switch to compact list view" |
There was a problem hiding this comment.
It looks like you only need to do this once in showCompactOrDefault() which is called on viewDidLoad and whenever isCompact value is changed. The less code, the better. What do you think? 🙂
As for the accessibilityLabel, this is a bit tricky because it's a toggle button. Changing the label can be confusing though. The user might think that it's a different button whenever it changes. My suggestion would be to have a static accessibilityLabel, “List style”, so the user will be able to identify that it's the same button. And then change the accessibilityValue.
| Layout Style | accessibilityLabel |
accessibilityValue |
|---|---|---|
| Expanded | List style | expanded |
| Compact | List style | compact |
The label and the values will still be spoken by VoiceOver.
- Move to
showCompactOrDefault() - Use
accessibilityValue
There was a problem hiding this comment.
I did write that line twice, because I thought it was possible that the user might have left the app on a certain compact or expanded view, and they might want to return to their choice of view. So it calculates once on Edit: alright I understand viewDidLoad and when the toggle is hit. Is this not necessary?showCompactOrDefault() now, my bad! Will get to it
I'll work on the other changes as well!
Fixes #12872 - preliminary version
To test: VoiceOver on physical device
PR submission checklist:
I have considered adding unit tests where possible.
I have considered if this change warrants user-facing release notes and have added them to
RELEASE-NOTES.txtif necessary.