react-native-macos/Libraries
Adam Comella 863f585be5 iOS: Improve accessibility of multiline TextInputs
Summary:
Fixes #13691.

Prior to this change, VoiceOver generally didn't say anything when selecting a multiline TextInput. The only exception was VoiceOver would announce the TextInput's placeholder if it had one set.

After this change, VoiceOver announces the following for multiline TextInputs:
  - The TextInput's content.
  - The TextInput's placeholder if the TextInput doesn't have any content in it.
  - The fact that the TextInput is a textfield.
  - The cursor position if the TextInput is being edited.

This is similar to the behavior of single line TextInputs.

This change achieves this by disabling `RCTTextView` as an accessibility element. `RCTTextView` is a subclass of `RCTView` so VoiceOver doesn't recognize this as a textfield. Instead, VoiceOver now sees the child `RCTUITextView` which is a subclass of `UITextView` so VoiceOver does recognize it as a textfield. Additionally, an `accessibilityLabel` implementation was added to `RCTUITextView` in order to take the value of the placeholder into account.

Verified the announcements of TextInputs with various props:
  - No placeholder and no content
  - Just a placeholder
  - Just content
  - Both a placeholder and content

Did this for both singe line inputs and multiline inputs. For setting content in multiline inputs, I tested both using the `value` prop and passing children. All other props being equal, these configurations resulted in similar announcements.

I verified that the following accessibility props work the same on singleline and multiline TextInputs:
  - `accessible`
  - `accessibilityLabel`
  - `accessibilityTraits`
  - `accessibilityViewIsModal`
  - `onAccessibilityTap`
  - `onMagicTap`

Additionally, my team has been using this change in our app.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/14200

Differential Revision: D5185727

Pulled By: shergin

fbshipit-source-id: 94271e6c8b089eb82006b52fe7917649d69e74af
2017-06-05 16:15:45 -07:00
..
ART call toString on fontWeight else throws error if passed an integer 2017-05-25 01:34:53 -07:00
ActionSheetIOS Enable -Wimplicit-retain-self en sync warning config for all projects 2017-03-23 15:01:34 -07:00
AdSupport Update AdSupportIOS.js 2017-04-28 06:34:21 -07:00
Alert Export Alert's type ButtonsArray for external use 2017-03-06 12:44:47 -08:00
Animated Add missing documentation to animated spring config 2017-05-30 14:36:06 -07:00
AppState Added stubs for some native modules 2017-06-01 08:31:19 -07:00
BatchedBridge Only call callImmediates once per batch 2017-06-02 08:17:07 -07:00
BugReporting Patch up for future React Sync 2017-02-08 14:50:43 -08:00
CameraRoll Export an object instead of array for asset type 2017-05-04 21:49:45 -07:00
Components Improve view props and style stuff. 2017-06-01 01:15:42 -07:00
Core Only call callImmediates once per batch 2017-06-02 08:17:07 -07:00
DebugComponentHierarchy Move React Core Integration to a Dependency 2016-04-21 09:28:23 -07:00
EventEmitter Added stubs for some native modules 2017-06-01 08:31:19 -07:00
Experimental Fix react-native function call arity errors 2017-05-18 16:55:55 -07:00
Geolocation Exposes requestAuthorization method. 2017-05-25 07:07:50 -07:00
Image Fix Travis CI runs 2017-06-02 09:03:18 -07:00
Inspector Remove dependency on internal data structure 2017-06-01 13:06:24 -07:00
Interaction Re-license and rename UIExplorer integration test app as RNTester 2017-05-08 11:31:19 -07:00
JSInspector Add Network agent 2016-11-02 12:29:15 -07:00
LayoutAnimation Fix prop-types warning in LayoutAnimation 2017-05-12 15:06:17 -07:00
Linking Add newly recommended method for RCTLinkingManager due to deprecation 2017-05-25 11:31:23 -07:00
LinkingIOS Add newly recommended method for RCTLinkingManager due to deprecation 2017-05-25 11:31:23 -07:00
Lists Update SectionList.js 2017-05-31 23:49:35 -07:00
Modal Ran PropTypes -> prop-types codemod against Libraries/FBReactKit/js/react-native-github 2017-04-12 16:15:15 -07:00
NativeAnimation Native Animated - Support Animated.loop on iOS 2017-05-26 03:30:33 -07:00
Network Added stubs for some native modules 2017-06-01 08:31:19 -07:00
Performance Clean up unused metrics 2017-05-09 13:30:26 -07:00
PermissionsAndroid Include Create React Native App in Getting Started 2017-04-26 07:16:18 -07:00
PushNotificationIOS Play sound in local notification only if soundName is specified 2017-05-28 15:37:10 -07:00
RCTTest Using `drawViewHierarchyInRect` instead of `renderInContext` for snapshot tests 2017-05-26 15:16:07 -07:00
ReactNative Cleanup perf logging in FacebookAppRouteHandler 2017-06-01 04:15:57 -07:00
Renderer Refactor of Fiber integration with React Fiber + Stack 2017-05-30 10:02:32 -07:00
Sample Fix missing RCTBridgeModule.h 2017-01-31 11:13:50 -08:00
Settings Enable -Wimplicit-retain-self en sync warning config for all projects 2017-03-23 15:01:34 -07:00
Share Flowify Process Color 2017-04-26 11:31:56 -07:00
Storage correctly order ASyncStorage 2017-02-21 15:18:40 -08:00
StyleSheet Flat ReactNative renderer bundle [WIP] 2017-05-26 11:03:06 -07:00
Text iOS: Improve accessibility of multiline TextInputs 2017-06-05 16:15:45 -07:00
Utilities Cleanup PerformanceLogger a bit 2017-06-01 10:03:27 -07:00
Vibration Enable -Wimplicit-retain-self en sync warning config for all projects 2017-03-23 15:01:34 -07:00
WebSocket Added stubs for some native modules 2017-06-01 08:31:19 -07:00
react-native Introducing <ImageBackground>, replacement for <Image> which supports nesting views 2017-05-24 11:30:48 -07:00
vendor Remove `copyProperties` 2017-03-21 08:01:58 -07:00
Promise.js Allow Promise to display error strings and not just error objects. 2017-03-09 14:30:57 -08:00
promiseRejectionIsError.js RN: Cleanup OSS JS & Flow Declarations 2016-11-20 17:58:29 -08:00