From b00c1fa3b66a2c9070a4dfc04aeed205a10d4798 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Mon, 27 Feb 2017 23:38:35 -0800 Subject: [PATCH] `accessibilityViewIsModal` property was exposed for any view (iOS only) Reviewed By: mmmulani Differential Revision: D4582786 fbshipit-source-id: 0902b8cc762042e772798ea7eaa350bc9d737cfb --- Libraries/Components/View/View.js | 12 ++++++++++++ React/Views/RCTViewManager.m | 3 ++- docs/Accessibility.md | 7 +++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Libraries/Components/View/View.js b/Libraries/Components/View/View.js index 938dca8ad..43ef58152 100644 --- a/Libraries/Components/View/View.js +++ b/Libraries/Components/View/View.js @@ -231,6 +231,18 @@ const View = React.createClass({ PropTypes.arrayOf(PropTypes.oneOf(AccessibilityTraits)), ]), + /** + * A value indicating whether VoiceOver should ignore the elements + * within views that are siblings of the receiver. + * Default is `false`. + * + * See the [Accessibility guide](docs/accessibility.html#accessibilitytraits-ios) + * for more information. + * + * @platform ios + */ + accessibilityViewIsModal: PropTypes.bool, + /** * When `accessible` is true, the system will try to invoke this function * when the user performs accessibility tap gesture. diff --git a/React/Views/RCTViewManager.m b/React/Views/RCTViewManager.m index c743c7865..d551781d2 100644 --- a/React/Views/RCTViewManager.m +++ b/React/Views/RCTViewManager.m @@ -114,10 +114,11 @@ RCT_EXPORT_VIEW_PROPERTY(hasTVPreferredFocus, BOOL) RCT_EXPORT_VIEW_PROPERTY(tvParallaxProperties, NSDictionary) #endif +RCT_REMAP_VIEW_PROPERTY(accessible, isAccessibilityElement, BOOL) RCT_EXPORT_VIEW_PROPERTY(accessibilityLabel, NSString) RCT_EXPORT_VIEW_PROPERTY(accessibilityTraits, UIAccessibilityTraits) +RCT_EXPORT_VIEW_PROPERTY(accessibilityViewIsModal, BOOL) RCT_EXPORT_VIEW_PROPERTY(backgroundColor, UIColor) -RCT_REMAP_VIEW_PROPERTY(accessible, isAccessibilityElement, BOOL) RCT_REMAP_VIEW_PROPERTY(testID, accessibilityIdentifier, NSString) RCT_REMAP_VIEW_PROPERTY(backfaceVisibility, layer.doubleSided, css_backface_visibility_t) RCT_REMAP_VIEW_PROPERTY(opacity, alpha, CGFloat) diff --git a/docs/Accessibility.md b/docs/Accessibility.md index 3902b36f9..b09215064 100644 --- a/docs/Accessibility.md +++ b/docs/Accessibility.md @@ -74,6 +74,13 @@ To use, set the `accessibilityTraits` property to one of (or an array of) access * **allowsDirectInteraction** Used when an element allows direct touch interaction for VoiceOver users (for example, a view representing a piano keyboard). * **pageTurn** Informs VoiceOver that it should scroll to the next page when it finishes reading the contents of the element. +#### accessibilityViewIsModal (iOS) + +A Boolean value indicating whether VoiceOver should ignore the elements within views that are siblings of the receiver. + +For example, in a window that contains sibling views `A` and `B`, setting `accessibilityViewIsModal` to `true` on view `B` causes VoiceOver to ignore the elements in the view `A`. +On the other hand, if view `B` contains a child view `C` and you set `accessibilityViewIsModal` to `true` on view `C`, VoiceOver does not ignore the elements in view `A`. + #### onAccessibilityTap (iOS) Use this property to assign a custom function to be called when someone activates an accessible element by double tapping on it while it's selected.