-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pressable with button role does not fire onPress on space key press #2560
Comments
This seems to be how Pressable has worked for a while. I tested 0.17 and 0.18 and it behaved the same. https://codesandbox.io/s/dazzling-greider-y38h47?file=/package.json I couldn't change package versions in your non-standard test case. |
For the test case, that's the new VM in codesandbox, to switch package versions you can update them in package.json and run yarn in the terminal, it truly works like locally. Back to the issue, I made two separate playground so it's easier to identify it: With RNW 0.17Playground: https://codesandbox.io/s/admiring-elion-lgy9zw?file=/src/App.js with accessibilityRole="button" (
|
I think this will fix the issue: #2563 |
@necolas I confirm, it fixes it. Both space and enter fire Screen.Recording.2023-07-20.at.10.39.36.mov |
Is there an existing issue for this?
Describe the issue
Hi! 👋
We noticed something strange lately: when using keyboard navigation with
Pressable
usingrole="button"
, using the space bar to press only trigger the visual focus (pressed
istrue
instyle
), but doesn't fireonPress
. When using theenter
key, both are working.Expected behavior
onPress
should be fire, in a similar way as pressing the enter keySteps to reproduce
Pressable
with a button role using keyboard navigationpressed
, butonPress
is not firedTest case
https://codesandbox.io/p/sandbox/holy-darkness-pfk6m8?file=%2Fsrc%2Fmain.tsx%3A17%2C29
Additional comments
I think it might happen since it's now using the HTML button element underneath.
The text was updated successfully, but these errors were encountered: