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

Add accessibilityHint for iOS #18093

Closed
wants to merge 5 commits into from

Conversation

draperunner
Copy link
Contributor

@draperunner draperunner commented Feb 26, 2018

This adds the accessibilityHint for View, Text and Touchable* on iOS.
The accessibilityHint provides some more information about an element
when the accessibilityLabel is not enough.

Motivation

The accessibilityHint is a core accessibility property on iOS.

From https://developer.apple.com/documentation/objectivec/nsobject/1615093-accessibilityhint:

An accessibility hint helps users understand what will happen when they perform an action on the accessibility element when that result is not obvious from the accessibility label.

Related issue: #14706

Test Plan

The npm scripts test, flow, lint and prettier are satisfied.

I added a couple of examples to the RNTester app. The Accessibility Inspector on Mac helps debugging accessibility stuff on a simulator, but it does not show the accessibilityHint. Therefore I tested the RNTester app on an iPhone 8 device using VoiceOver to verify the hint functionality. It works fine, and I've tested disabling and enabling "read hints" in the VoiceOver settings on the phone.

Related PRs

facebook/react-native-website#222

Release Notes

[IOS][FEATURE][Accessibility] - Add accessibilityHint for View, Text, Touchable* on iOS

@draperunner draperunner requested a review from shergin as a code owner February 26, 2018 09:37
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. cla signed labels Feb 26, 2018
@sdwilsh sdwilsh removed the cla signed label Mar 1, 2018
Copy link
Contributor

@janicduplessis janicduplessis left a comment

Choose a reason for hiding this comment

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

Looks good, just one question inline.

@@ -154,6 +154,15 @@ - (NSString *)accessibilityLabel
return RCTRecursiveAccessibilityLabel(self);
}

- (NSString *)accessibilityHint
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this needed? Can't we just use the prop directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, it is not needed. I tested after removing it, and it still works. I've updated this in the latest commit, 196ce06

@janicduplessis
Copy link
Contributor

Thanks for the PR!

@facebook-github-bot shipit

@facebook-github-bot
Copy link
Contributor

Something went wrong executing that command, @hramos could you take a look?

@facebook-github-bot facebook-github-bot added Failed Commands Import Started This pull request has been imported. This does not imply the PR has been approved. labels Mar 12, 2018
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@janicduplessis is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot facebook-github-bot added Import Failed and removed Import Started This pull request has been imported. This does not imply the PR has been approved. labels Mar 12, 2018
@facebook-github-bot
Copy link
Contributor

I tried to merge this pull request into the Facebook internal repo but some checks failed. To unblock yourself please check the following: Does this pull request pass all open source tests on GitHub? If not please fix those. Does the code still apply cleanly on top of GitHub master? If not can please rebase. In all other cases this means some internal test failed, for example a part of a fb app won't work with this pull request. I've added the Import Failed label to this pull request so it is easy for someone at fb to find the pull request and check what failed. If you don't see anyone comment in a few days feel free to comment mentioning one of the core contributors to the project so they get a notification.

@hramos hramos added the Platform: iOS iOS applications. label Mar 13, 2018
@draperunner
Copy link
Contributor Author

Hi @janicduplessis, seems like facebook-github-bot met some issues. Anything I can do?

@hramos
Copy link
Contributor

hramos commented Mar 15, 2018

@draperunner Janic does not have visibility into the failure but I can help in this regard. It looks like this is held back due to a failing snapshot test. Getting this PR merged will require some manual intervention on my part.

It's possible that the failing test is unrelated to this PR, so let me run the internal diff through the test suite one more time. Please do not add any more commits to this PR as doing so will prevent it from landing. Thanks!

@janicduplessis
Copy link
Contributor

@hramos This adds a prop to View so it is very possible that some snapshots need to be updated.

@hramos
Copy link
Contributor

hramos commented Mar 15, 2018

Indeed that's the case. The failing snapshot tests are all due to accessibilityHint being added to the props. I'll take care of this.

@hramos
Copy link
Contributor

hramos commented Mar 15, 2018

Snapshot tests updated and test suites are currently running. I'll check again in tomorrow morning and land this if all looks green.

@hramos
Copy link
Contributor

hramos commented Mar 17, 2018

** BUILD FAILED **
The following commands produced analyzer issues:
Analyze Base/RCTModuleMethod.mm
Analyze Modules/RCTUIManager.m
(2 commands with analyzer issues)
The following build commands failed:
Ld /Users/facebook/Library/Developer/Xcode/DerivedData/RNTester-gmzkrbslacaqklccqmdfkejruuag/Build/Products/Debug-iphonesimulator/RNTester.app/RNTester normal x86_64

@draperunner
Copy link
Contributor Author

Any updates on this @hramos?

@janicduplessis
Copy link
Contributor

@hramos @draperunner The PR doesn't touch any of the files from the log, maybe rebase on master and we can try shipping again.

draperunner and others added 4 commits June 19, 2018 16:53
This adds the accessibilityHint for View, Text and Touchable* on iOS.
The accessibilityHint provides some more information about an element
when the accessibilityLabel is not enough.
@draperunner
Copy link
Contributor Author

@hramos @janicduplessis Hi guys. I have now rebased this PR and added Flow types.

@janicduplessis
Copy link
Contributor

@hramos Wanna try landing this again? It will still require some snapshot updates.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@hramos has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@knitcodemonkey
Copy link

Cc @TheSavior

@hramos
Copy link
Contributor

hramos commented Jul 25, 2018

This will be landing soon.

@react-native-bot
Copy link
Collaborator

This pull request was closed by @draperunner in 253b29d.

Once this commit is added to a release, you will see the corresponding version tag below the description at 253b29d. If the commit has a single master tag, it is not yet part of a release.

@facebook facebook locked as resolved and limited conversation to collaborators Jul 26, 2018
@react-native-bot react-native-bot added the Merged This PR has been merged. label Jul 26, 2018
@draperunner draperunner deleted the accessibility-hint branch July 26, 2018 13:53
rozele pushed a commit to microsoft/react-native-windows that referenced this pull request Aug 17, 2018
Summary:
This adds the accessibilityHint for View, Text and Touchable* on iOS.
The accessibilityHint provides some more information about an element
when the accessibilityLabel is not enough.

The accessibilityHint is a core accessibility property on iOS.

From https://developer.apple.com/documentation/objectivec/nsobject/1615093-accessibilityhint:
> An accessibility hint helps users understand what will happen when they perform an action on the accessibility element when that result is not obvious from the accessibility label.

Related issue: facebook/react-native#14706

The npm scripts `test`, `flow`, `lint` and `prettier` are satisfied.

I added a couple of examples to the RNTester app. The Accessibility Inspector on Mac helps debugging accessibility stuff on a simulator, but it does not show the accessibilityHint. Therefore I tested the RNTester app on an iPhone 8 device using VoiceOver to verify the hint functionality. It works fine, and I've tested disabling and enabling "read hints" in the VoiceOver settings on the phone.

facebook/react-native-website#222

[IOS][FEATURE][Accessibility] - Add accessibilityHint for View, Text, Touchable* on iOS
Closes facebook/react-native#18093

Reviewed By: hramos

Differential Revision: D7230780

Pulled By: ziqichen6

fbshipit-source-id: 172ad28dc9ae2b67ea256100f6acb939f2466d0b
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Platform: iOS iOS applications.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants