Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
[Android] Keyboard accessibility improvements #24359
In order to meet our accessibility requirements we need to have full support for keyboard navigation. The Touchable components works with press/tap with a finger, but doesn't respond to 'enter' when using a keyboard. Navigation works fine. This PR adds an onClick listener to touchable views that have the onPress prop defined.
[Android] [Added] - Add View.OnClickListener to Touchable components when onPress is defined
Add any Touchable component with an onPress callback. Use a keyboard and navigate to the touchable component and press the 'enter' key. Expected behavior is that the onPress callback is called.
Sam Mathias Weggersen
blavalla left a comment
To note up front, I am not very familiar with React Native's touchable elements, so I may be way off here, but I'm not sure that I follow along as to why we need to define a new "clickable" prop to make these work correctly.
It seems like anything that has an onClick or onPress listener should already be setting the View's focusable and clickable attributes to true. If that isn't happening already, should we not just fix that rather than adding a new prop?
@cpojer - I'm not sure who is most familiar with the ReactNative side of things here, but from an accessibility standpoint setting clickable/focusable on the View is helpful. I don't see why we wouldn't just want to always do this for any view that is clickable/touchable though.