Skip to content
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

added accessibility props for touchables #5346

Conversation

fangmobile
Copy link
Contributor

accessibilityLabels are missing in these touchable*.js files.
for #5322
@ide This is not tested yet. I will update with test.

@facebook-github-bot
Copy link
Contributor

By analyzing the blame information on this pull request, we identified @spicyj, @mkonicek and @vjeux to be potential reviewers.

@facebook-github-bot facebook-github-bot added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Jan 15, 2016
@mkonicek
Copy link
Contributor

lgtm

cc @sahrens

@fangmobile fangmobile force-pushed the accessiblityLabel_for_touchables branch from 69b4421 to 74319ba Compare January 22, 2016 20:07
@facebook-github-bot
Copy link
Contributor

@fangmobile updated the pull request.

@fangmobile
Copy link
Contributor Author

my coworker @annjose verified this fix works.
Basically she build react native from source off my fork, added accibilityLabel in touchable highlight in UI explorer example like so

<TouchableHighlight
            accessibilityLabel="AnnAccessLabel_TouchableHighlight_WithImage"
            style={styles.wrapper}
            onPress={() => console.log('stock THW image - highlight')}>
            <Image
              source={heartImage}
              style={styles.image}
            />

And verified the the label shows up in uiautomator viewer.
Please see attached image
Before this fix the content description will be empty even if you set the accessibilityLabel in code.
@ide @mkonicek @sahrens Please let us know whether this is good enough?
rn

@facebook-github-bot
Copy link
Contributor

@fangmobile updated the pull request.

@fangmobile fangmobile force-pushed the accessiblityLabel_for_touchables branch from b506df5 to 816130a Compare January 28, 2016 22:11
@facebook-github-bot
Copy link
Contributor

@fangmobile updated the pull request.

@fangmobile
Copy link
Contributor Author

As we was working on another task in our project we noticed textinput does not have accessibility because it is using a touchable. This is more serious than touchable. In touchables sometimes you can get the child view's accessibility label, such as the "Press Me" string in TcouchaExample.js. In textinput.js there is just touchable. And if it is not accessible then the text input field is totally not accessible.

I update this PR with a fix in textinput.js. Attaching some "before" and "after" screenshots. This is tested for Both iOS and Android. BTW the previous commit was also tested both in iOS and Android but there was not screen shot for iOS.

Before this fix there is no accessibility label even if you set them in TextInputExample.android.js or TextINnputExample.ios.js.

iOS before the fix. There is only "value", no accessibility label.
screen shot 2016-01-27 at 2 58 09 pm

ios after the fix
screen shot 2016-01-28 at 12 47 59 am
Android before the fix.
screen shot 2016-01-27 at 2 57 13 pm

Android after the fix
screen shot 2016-01-28 at 12 40 07 am

* @platform android
*/
accessibilityComponentType: React.PropTypes.oneOf(View.AccessibilityComponentType),
/**
Copy link
Contributor

Choose a reason for hiding this comment

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

All of these should be already pulled in via the ...View.propTypes above (see View.js). Is there a need to duplicate the props here?

@mkonicek
Copy link
Contributor

Besides the inline comment looks good. Thanks for adding the screenshots!

@fangmobile fangmobile force-pushed the accessiblityLabel_for_touchables branch from 816130a to b9298fd Compare January 29, 2016 03:43
@facebook-github-bot
Copy link
Contributor

@fangmobile updated the pull request.

@fangmobile
Copy link
Contributor Author

Thanks @mkonicek for catching this.
You are right that they are not needed. I put them in by mistake because I saw testID there but the rest missing. So when I remove them I also removed testId which should also come from View.js.
Here is the quick test I did. With the accessibility props still set in the example js file:

  1. Remove them from the propTypes part but keep them in return function. Still works.
  2. Remove them from both locations. Accessibility Label is gone.

This show they are not needed in propTypes but need to be returned.

Also squshed commits. Please let me know if there is anything I should do.

@@ -208,7 +208,11 @@ exports.examples = [
{
title: 'Auto-focus',
render: function() {
return <TextInput autoFocus={true} style={styles.singleLine} />;
return <TextInput
Copy link
Contributor

Choose a reason for hiding this comment

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

code style, please write this as:

return (
  <TextInput
    props.....
  />
);

@ide
Copy link
Contributor

ide commented Jan 29, 2016

@fangmobile thanks for the test plan!

@fangmobile fangmobile force-pushed the accessiblityLabel_for_touchables branch from b9298fd to 6a4db1c Compare January 29, 2016 07:11
@facebook-github-bot
Copy link
Contributor

@fangmobile updated the pull request.

@fangmobile
Copy link
Contributor Author

@ide Thanks. Amended another commit.

@fangmobile fangmobile force-pushed the accessiblityLabel_for_touchables branch from 6a4db1c to 2091350 Compare January 29, 2016 16:02
@fangmobile fangmobile force-pushed the accessiblityLabel_for_touchables branch from 2091350 to bb594ad Compare January 29, 2016 21:16
@fangmobile
Copy link
Contributor Author

builds were failing due to an unrelated commit on master that was reverted. Now all good.
@ide @mkonicek good to go?

@ide
Copy link
Contributor

ide commented Jan 29, 2016

@facebook-github-bot shipit

@facebook-github-bot
Copy link
Contributor

Thanks for importing. If you are an FB employee go to https://our.intern.facebook.com/intern/opensource/github/pull_request/1558082531149705/int_phab to review.

@fangmobile
Copy link
Contributor Author

👍

@fangmobile
Copy link
Contributor Author

@ mkonicek anything else I should do?
Sorry for the harassment. We need to have accessibility for them for compliance requirement. Also our Android automation is blocked by this because our Android functional tests use Appium which can not read testId (view tag) so we replying on content descriptions.

@bestander
Copy link
Contributor

@fangmobile, sorry, our internal CI got stuck with this one.
A colleague is taking control over it right now.
Please ping us in a few hours if it does not get resolved, this is a very important PR for the community 👍

@ghost ghost closed this in 33d8db5 Feb 4, 2016
@fangmobile
Copy link
Contributor Author

👍
Thanks guys.

bestander pushed a commit that referenced this pull request Feb 5, 2016
Summary:
accessibilityLabels are missing in these touchable*.js files.
for #5322
ide This is not tested yet. I will update with test.
Closes #5346

Reviewed By: svcscm

Differential Revision: D2882061

Pulled By: gkassabli

fb-gh-sync-id: dff0ef373e5f5895027cb1cc08c8887a6ace8eee
pglotov pushed a commit to pglotov/react-native that referenced this pull request Mar 15, 2016
Summary:
accessibilityLabels are missing in these touchable*.js files.
for facebook#5322
ide This is not tested yet. I will update with test.
Closes facebook#5346

Reviewed By: svcscm

Differential Revision: D2882061

Pulled By: gkassabli

fb-gh-sync-id: dff0ef373e5f5895027cb1cc08c8887a6ace8eee
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants