I'm integrating the react-aria
hook library into my codebase to ensure that my custom components properly meet all ARIA accessibility requirements. I've immediately noticed however that when I use the props generated by the library's useButton
hook as described in the documentation, that a button which was focused with Tab no longer executes its onClick
event on key press of Enter or Space, functionality that previously worked just fine before integration of the library.
The below sandbox illustrates the issue: Tabbing to the green button (the RegularButton
component) and pressing Enter or Space will fire the onClick
event and render the message. However, toggling to the red button (the ButtonWithReactAria
component) and pressing Enter or Space will result in nothing happening.
https://codesandbox.io/p/sandbox/twilight-cloud-np66r3
Does anyone know what's causing this issue?