react-native-macos/Libraries
Kacie Bawiec 8ced165e53 Make Text use Android's "auto" focus by default instead of setting focus to true
Summary:
[A recent fix](https://github.com/facebook/react-native/pull/33076) to Android to set focusable to true when accessible is true, and this caused several components not to work correctly.

This JS change essentially reverts the default back to Text not being focusable unless it is explicitly set. Android's "auto" behavior is better than setting `accessible=true`, and it's also the behavior React Native has had since accessibility on Android was implemented.

# Wall of Text Explanation

Explanation From Brett's comment [here](https://www.internalfb.com/diff/D35908559?dst_version_fbid=700876567897063&transaction_fbid=477905564133412)

blavalla

Generally speaking, "accessible" in react native maps to "focusable" in Android views, and the default value for "focusabe" for a TextView (and actually all views) is "auto" not "false".  The difference here is that "false" is telling the system to explicitly disallow focus on this element, where as "auto" is telling the system that it's up to whatever service is trying to focus to determine if it should or not.

In the case of text, Talkback generally does default to focusing on Text when it's set to "auto", though it also does try to combine this text together with other not-explicitly focusable siblings and roll the focus up to some common ancestor element.

In the case of TetraButton here, I would expect the default behavior would be that the text is "auto" focusable, so Talkback would combine the text here with the parent <TetraPressable> (which is explicitly focusable via accessible="true").

...

[This diff](https://github.com/facebook/react-native/pull/33076) was to fix the issue with "disabled" not properly announcing on text views, which was commonly occuring due to the description-combining feature described above. Basically, when Talkback decides to combine not-explicitly-focusable elements together, it ignores properties like "disabled", "selected", etc. so when combined only the text is transferred.

The "fix" here was to make sure that if disabled was set, that an element was always explicitly focusable so that it wouldn't be eligible to be combined with others. I think that as a general concept makes sense, but the fix actually surfaced an issue that is likely a much older bug.

This line in <Text>
```
accessible={accessible !== false}
```

Is basically always setting accessible="true" unless it's explicitly set to false, and has been in there for years. It was likely added to force text to be accessible by default for iOS.  But until [this diff](https://github.com/facebook/react-native/pull/33076) this line was basically a no-op for Android, since setting accessible="true" on text would do nothing at all.

[This diff](https://github.com/facebook/react-native/pull/33076)  changed this so that setting accessible="true" worked how you'd expect, by making the view explicitly focusable, which was necessary for the disabled behavior to work properly. But that means that now by default all text views are explicitly focusable on both iOS and Android, and this there is likely many components that were built that don't expect this to be the case.

It doesn't seem like the right fix here is to revert this behavior to its previous state, as it wasn't working how anyone would expect it to if they looked at the code, and it seems like we were relying on some fairly undocumented behavior of Talkback to get it to work how we wanted. If we truly only wanted accessible="true" to be set on all TextViews for iOS, we should be explicit about it and do a platform check before setting that property. If we didn't want this to be iOS-specific, then everything is now actually working as originally intended.

For reference, this is the diff that introduced the default-accessible text - https://www.internalfb.com/diff/D1561326, and the description makes it clear that this was only tested on iOS, and the behavior was explicitly trying to map to iOS norms such as not allowing nested accessible elements.

Changelog:
[Android][Fixed] Make Text not focusable by default

Reviewed By: ryancat

Differential Revision: D36991394

fbshipit-source-id: c45d2ada72bb2d6ffeee6947d676a07fb8899449
2022-06-09 13:27:09 -07:00
..
ActionSheetIOS bump iOS and tvOS from 11.0 to 12.4 in cocoapods 2022-03-16 21:08:01 -07:00
Alert Added userInterfaceStyle to Alert to override user interface style for iOS 13+ (#33553) 2022-06-08 18:28:16 -07:00
Animated Use initial value of natively driven nodes on renders 2022-06-07 20:02:57 -07:00
AppState fix: remove deprecated removeListener methods (#33580) 2022-05-04 11:32:51 -07:00
BatchedBridge Add more information to JavaScript module not registered as callable error message 2022-05-25 13:21:08 -07:00
Blob fire: (FileReader) remove unused _subscriptions attribute (#33946) 2022-06-01 17:13:11 -07:00
BugReporting Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
Components typo for the automaticallyAdjustKeyboardInsets description (#33948) 2022-06-01 13:25:20 -07:00
Core Remove nonstandard Promise.prototype.done implementation 2022-05-05 03:55:10 -07:00
EventEmitter fix: remove deprecated removeListener methods (#33580) 2022-05-04 11:32:51 -07:00
Events CustomEvent and Event polyfills for React Native 2022-03-02 11:39:00 -08:00
FBLazyVector Fixup typo in pfh labels 2022-04-05 12:15:05 -07:00
HeapCapture Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
Image Lock down constrain writes in some directories 2022-05-06 15:53:13 -07:00
Inspector Add annotations to empty objects that look like indexers in Xplat 2022-05-03 19:59:28 -07:00
Interaction Add annotations to unannotated variable declarations [manually-modified] 2022-04-27 19:15:55 -07:00
JSInspector Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
LayoutAnimation Refactor LayoutAnimation to use ReactNativeFeatureFlags 2022-02-18 18:23:00 -08:00
Linking fix: remove deprecated removeListener methods (#33580) 2022-05-04 11:32:51 -07:00
LinkingIOS bump iOS and tvOS from 11.0 to 12.4 in cocoapods 2022-03-16 21:08:01 -07:00
Lists Fixing onEndReachedThreshold === 0 not firing onEndReached function on Android. 2022-06-07 16:22:12 -07:00
LogBox Presuppress xplat and upgrade to 0.178.1 2022-05-26 12:59:52 -07:00
Modal Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
NativeAnimation Batch Animated calls into one JSI call per frame 2022-05-17 16:42:41 -07:00
NativeComponent Add dispatch of pointerover/pointerout events 2022-06-07 16:08:50 -07:00
NativeModules/specs Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
Network Protect _handlers in RCTNetworking with mutex even if RCTNetworking has been deallocated 2022-06-05 11:02:11 -07:00
NewAppScreen Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
Performance Presuppress xplat and upgrade to 0.178.1 2022-05-26 12:59:52 -07:00
PermissionsAndroid Add `READ_VOICEMAIL` and `WRITE_VOICEMAIL` permissions (#33965) 2022-06-06 11:37:34 -07:00
Pressability Fill out w3c pointer event types 2022-05-19 18:48:24 -07:00
PushNotificationIOS Update RCTPushNotificationManager checkPermissions API to support iOS 10+ 2022-04-06 20:15:22 -07:00
RCTRequired Fixup typo in pfh labels 2022-04-05 12:15:05 -07:00
ReactNative Batch Animated calls into one JSI call per frame 2022-05-17 16:42:41 -07:00
ReactPrivate CustomEvent and Event polyfills for React Native 2022-03-02 11:39:00 -08:00
Reliability Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
Renderer React Native sync for revisions bd4784c...d300ceb 2022-06-06 10:58:29 -07:00
Settings bump iOS and tvOS from 11.0 to 12.4 in cocoapods 2022-03-16 21:08:01 -07:00
Share Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
Storage Add annotations to empty objects that look like indexers in Xplat 2022-05-03 19:59:28 -07:00
StyleSheet Presuppress xplat and upgrade to 0.178.1 2022-05-26 12:59:52 -07:00
SurfaceBackedComponent 5/n Allow CKComponents to embed Fabric surfaces 2022-03-29 11:52:49 -07:00
SurfaceHostingComponent 5/n Allow CKComponents to embed Fabric surfaces 2022-03-29 11:52:49 -07:00
Text Make Text use Android's "auto" focus by default instead of setting focus to true 2022-06-09 13:27:09 -07:00
TurboModule Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
TypeSafety Remove folly import in GenerateModuleObjCpp 2022-03-22 17:10:18 -07:00
Types Fill out w3c pointer event types 2022-05-19 18:48:24 -07:00
Utilities Move ReactNativeTestTools-test to github 2022-05-23 06:15:08 -07:00
Vibration bump iOS and tvOS from 11.0 to 12.4 in cocoapods 2022-03-16 21:08:01 -07:00
WebSocket Fixes to non-product code (e.g React Native) 2022-05-04 16:13:07 -07:00
Wrapper Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
YellowBox Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
__flowtests__ Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
vendor RN: Delete `EventEmitter#removeSubscription` 2022-05-05 12:55:00 -07:00
.npmignore npmignore: ignore tests and fixtures 2018-02-27 08:42:14 -08:00
Promise.js Remove nonstandard Promise.prototype.done implementation 2022-05-05 03:55:10 -07:00
UTFSequence.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
promiseRejectionTrackingOptions.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00