Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Text with onPress or onLongPress handler is not accessible with TalkB…
…ack (#34284) Summary: >Finally, the last catch relates to why these views are considered focusable. We've been working with the assumption that they are only focusable because accessible="true", but this is not the only property that can make a view focusable on Android. Android also makes all elements with onClick listeners or onLongPress listeners focusable Adding onPress handler to a Text Component does not call setClickable(true) ([test case](#30851 (comment))) #30851 (comment) Pressable, TouchableOpacity, Switch, TextInput, and TouchableNativeFeedback are focusable/accessible by default without an onPress handler or accessible prop. ```jsx <TouchableOpacity /> ``` The TouchableOpacity is accessible ```jsx <TouchableOpacity accessible={false} /> ``` The TouchableOpacity is not accessible ```jsx <TouchableOpacity accessible={false} onPress={() => console.log('pressed')} /> ``` The TouchableOpacity is accessible. https://github.com/facebook/react-native/blob/a70354df12ef71aec08583cca4f1fed5fb77d874/Libraries/Components/Touchable/TouchableOpacity.js#L249-L251 This and other PRs fixes #30851 ## Changelog [Android] [Fixed] - Text with onPress or onLongPress handler is not accessible with TalkBack Pull Request resolved: #34284 Test Plan: main branch #30 <details><summary>pr branch</summary> <p> <video src="https://user-images.githubusercontent.com/24992535/181207388-bbf8379b-71b8-44e9-b4b2-b5c44e9ac14d.mp4" width="1000" /> </p> </details> Reviewed By: cipolleschi Differential Revision: D39179107 Pulled By: blavalla fbshipit-source-id: 3301fb2b799f233660e3e08f6a87dad294ddbcd8
- Loading branch information