Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Android: using AccessibilityNodeInfo#addAction to announce Expandable…
…/Collapsible State (facebook#34353) Summary: >Expandable and Collapsible are unique in the Android Accessibility API, in that they are not represented as properties on the View or AccessibilityNodeInfo, but are only represented as AccessibilityActions on the AccessibilityNodeInfo. This means that Talkback determines whether or not a node is "expandable" or "collapsible", or potentially even both, by looking at the list of AccessibilityActions attached to the AccessibilityNodeInfo. >When setting the accessibilityState's expandable property, it should correlate to adding an action of either AccessibilityNodeInfoCompat.ACTION_EXPAND or AccessibilityNodeInfoCompat.ACTION_COLLAPSE on the AccessibilityNodeInfo. This work should be done in the ReactAccessibilityDelegate class's >Currently, this feature is being "faked" by appending to the contentDescription in the BaseViewManager class. This should be removed when this feature is implemented properly. fixes facebook#30841 ## Changelog [Android] [Fixed] - using AccessibilityNodeInfo#addAction to announce Expandable/Collapsible State Pull Request resolved: facebook#34353 Test Plan: - On some components, the state expanded/collapsed is properly announced on focus, on some it is not. - On some components only the expanded/collapsed state is announced, and not other component text. - Upon change, state change is not always announced. - The accessibilityState's "expanded" field does not seem to work on all element types (for example, it has no effect on 's). - using accessibilityActions it is possible to add an action for expand/collapse, but these are treated as custom actions and must have their own label defined, rather than using Androids built in expand/collapse actions, which Talkback has predefined labels for. https://snack.expo.io/0YOQfXFBi Tests 15th August 2022: - Paper [Tests](facebook#34353 (comment)) - Fabric [Tests](facebook#34353 (comment)) Tests 6th September 2022: - [Button which keeps control of extended/collapsed state in JavaScript with onAccessibilityAction, accessibilityActions and accessibiltyState (Paper)](facebook#34353 (comment)) - [TouchableWithoutFeedback keeps control of extended/collapsed state in Android Widget (Paper)](facebook#34353 (comment)) - [TouchableWithoutFeedback keeps control of extended/collapsed state in Android Widget (Fabric)](facebook#34353 (comment)) - [TouchableOpacity announces visible text and triggers expanded/collapsed with onPress and accessiblity menu (Fabric)](facebook#34353 (comment)) Announcing state with custom actions on Fabric (FAIL). The issue is not a regression from this PR, as documented in facebook#34353 (comment). It will be fixed in a separate PR. Reviewed By: NickGerleman Differential Revision: D39893863 Pulled By: blavalla fbshipit-source-id: f6af78b1839ba7d97eca052bd258faae00cbd27b
- Loading branch information