-
-
Notifications
You must be signed in to change notification settings - Fork 677
accessibility: Added captions for visually impaired users #4355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
Thanks @Gautam-Arora24 for these changes!
The most important piece of feedback I have is that these changes need to be manually tested: try navigating the app by audio, and find out what effect your changes have. Here's the upstream guides for doing so with either Android or iOS:
https://developer.android.com/guide/topics/ui/accessibility/testing
https://developer.apple.com/documentation/uikit/accessibility_for_ios_and_tvos/supporting_voiceover_in_your_app
Either one would be enough for a PR. (Later, before we really consider the accessibility support complete, we'll want to try it out on both because there may be relevant differences.)
src/nav/NavButtonGeneral.js
Outdated
<Touchable onPress={onPress}> | ||
<View style={this.styles.navButtonFrame}>{children}</View> | ||
<View | ||
accessible={true} | ||
accessibilityLabel="Go Back!" | ||
accessibilityHint="Navigates to the previous screen" | ||
style={this.styles.navButtonFrame} | ||
> | ||
{children} | ||
</View> | ||
</Touchable> |
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.
Take a look at the RN doc on accessibility:
https://reactnative.dev/docs/accessibility
The examples show touchable components with View
children, and the accessibility props are all set on the touchable.
That makes sense to me because that's the component the user actually interacts with. Let's follow that.
I suspect that in fact if you try this version, with TalkBack or VoiceOver, what you find may be that it actually work properly. See in particular from that doc:
When a view is an accessibility element, it groups its children into a single selectable component. By default, all touchable elements are accessible.
So the Touchable
is already an accessibility element; and it sounds like that may mean that its children, like this View
, won't be focusable at all so these props there won't be helpful.
src/compose/ComposeBox.js
Outdated
<View | ||
accessible={true} | ||
accessibilityLabel="Send Message" | ||
accessibilityHint="Sends a message !" | ||
> | ||
<FloatingActionButton | ||
style={this.styles.composeSendButton} | ||
Icon={editMessage === null ? IconSend : IconDone} | ||
size={32} | ||
disabled={message.trim().length === 0} | ||
onPress={editMessage === null ? this.handleSend : this.handleEdit} | ||
/> | ||
</View> |
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.
src/nav/NavButtonGeneral.js
Outdated
<View style={this.styles.navButtonFrame}>{children}</View> | ||
<View | ||
accessible={true} | ||
accessibilityLabel="Go Back!" |
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.
src/compose/ComposeBox.js
Outdated
accessibilityLabel="Send Message" | ||
accessibilityHint="Sends a message !" |
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.
No need for a hint when the label already conveys all the same information.
Also be sure to take a look at the Zulip project's guidelines for commit messages: |
3b8966a
to
27ed828
Compare
Thanks @Gautam-Arora24 ! This is looking like a promising structure. Let's split this up into several commits. That will help make it easier to analyze the different changes that are happening. You can read more about our approach to small, coherent commits here: Specifically, for this PR, let's do:
Then for the commits that actually add specific labels:
I'm not sure how much experience you have already with Git, but this is one of those things that might look like a pain but becomes very quick to do once you know the right commands. Here, I'd do it with commands like these:
There's a bunch of related useful information in Zulip's Git guide, and you can also always ask questions on chat.zulip.org in |
Oh, one other thought: ideally we should really have these strings translated. 🙂 I'll be fine with merging this PR with them just always in English, though -- and then we can work through wiring them up for translation as a followup. |
25a1816
to
5e7ae75
Compare
This PR is now splitted into several commits as per the requirements! |
Thanks @Gautam-Arora24 ! Please also do this part:
Separately, the last commit on top looks like a fix to a previous commit, which should be squashed into that one. See the discussion of coherent commits in the Zulip project's Git style guide: You can make both of these changes conveniently -- squashing that commit into a previous one, and editing the commit messages of other commits -- with |
5e7ae75
to
0efc001
Compare
0efc001
to
7dfa1c2
Compare
Through various tests on different messaging apps like WhatsApp, Messenger and Discord etc., I found that the label was either "Send message" or "Send button". So I used "Send message".
Through tests on system settings app and system messages app on Android, a user hears Navigate up when they click on back button. So I used this as a label on back button. For iOS the label should probably be something else, but this is better than not having it.
This already would have been good, but after adding the accessibilityLabel, this bit of code is definitely complex enough we want to avoid duplicating it.
Thanks @Gautam-Arora24 for the revision! Looks good -- merged. I made some small style edits to the commit messages before merge. Take a look: commit 4775de5
commit 311ffaf
commit 0c66376
commit 7a17dd6
The I highly recommend browsing through our Git history -- it's good for seeing examples of our commit style, among many other things. See our tips for reading Git history here: https://github.com/zulip/zulip-mobile/blob/master/docs/howto/git.md I also added a commit on top, just making a small refactor that this branch caused me to notice we should do. |
Why and how the change was made
This PR proposed to add captions for visually impaired users. I added captions for buttons like back button and send button. I used React Native's accessibilityLabel prop to add captions.
Tests done
I tested this app on both simulator and on the actual device, and it worked well for both the scenarios.
Fixes #4232