Browse files

Add accessibilityElementsHidden prop

Allow iOS to have similar accessibility functionality to Android. This PR exposes the `accessibilityElementsHidden` property on iOS which is similar to Android's `importantForAccessibility="no-hide-descendants"`

I didn't see any existing examples for testing native props being passed through, but I did add an example to the RNTester app. I've attached some screenshots using the Accessibility Inspector to verify the property was correctly passed through.


I've updated the website with appropriate documentation.


![screen shot 2018-01-16 at 10 23 50](
![screen shot 2018-01-16 at 10 23 59](

[IOS] [FEATURE] [View] - Added accessibilityElementsHidden property
Closes #17627

Differential Revision: D6806444

Pulled By: hramos

fbshipit-source-id: 50d31fdb92f4c59ae9355b019c422418b2e6cc24
  • Loading branch information...
aputinski authored and facebook-github-bot committed Jan 29, 2018
1 parent d676746 commit 31288161e188723456fdb336c494f3c8a3f5b0a8
@@ -55,6 +55,7 @@ export type ViewProps = {
importantForAccessibility?: 'auto'| 'yes'| 'no'| 'no-hide-descendants',
accessibilityTraits?: AccessibilityTrait | Array<AccessibilityTrait>,
accessibilityViewIsModal?: bool,
accessibilityElementsHidden?: bool,
onAccessibilityAction?: Function,
onAccessibilityTap?: Function,
onMagicTap?: Function,
@@ -173,6 +174,16 @@ module.exports = {
* See
accessibilityViewIsModal: PropTypes.bool,
* A value indicating whether the accessibility elements contained within
* this accessibility element are hidden.
* @platform ios
* See
accessibilityElementsHidden: PropTypes.bool,
* When `accessible` is true, the system will try to invoke this function
@@ -55,6 +55,9 @@ class AccessibilityIOSExample extends React.Component<{}> {
This text component's accessibilityLabel is set explicitly.
<View accessibilityElementsHidden={true}>
<Text>This view's children are hidden from the accessibility tree</Text>
@@ -113,6 +113,7 @@ - (RCTShadowView *)shadowView
RCT_REMAP_VIEW_PROPERTY(accessibilityLabel, reactAccessibilityElement.accessibilityLabel, NSString)
RCT_REMAP_VIEW_PROPERTY(accessibilityTraits, reactAccessibilityElement.accessibilityTraits, UIAccessibilityTraits)
RCT_REMAP_VIEW_PROPERTY(accessibilityViewIsModal, reactAccessibilityElement.accessibilityViewIsModal, BOOL)
RCT_REMAP_VIEW_PROPERTY(accessibilityElementsHidden, reactAccessibilityElement.accessibilityElementsHidden, BOOL)
RCT_REMAP_VIEW_PROPERTY(onAccessibilityAction, reactAccessibilityElement.onAccessibilityAction, RCTDirectEventBlock)
RCT_REMAP_VIEW_PROPERTY(onAccessibilityTap, reactAccessibilityElement.onAccessibilityTap, RCTDirectEventBlock)
RCT_REMAP_VIEW_PROPERTY(onMagicTap, reactAccessibilityElement.onMagicTap, RCTDirectEventBlock)

0 comments on commit 3128816

Please sign in to comment.