Closed petejodo closed 1 year ago
This feels like this can be the same possible solution that @villesau would like (described in https://github.com/ayrton/react-key-handler/issues/4#issuecomment-233568602). As mentioned in that issue I'm open to improvements and more than happy to accept contributions
Looks like I'm in need of this myself, I'll be working on a solution for this sometime soon 😊
Awesome. I've been wanting to help out and work on this but I've been super busy (+ a little vacation). I've actually had this tab open since I opened this issue to remind myself about it haha
As of right now a component that gets wrapped by
keyHandler
has to expectkeyValue
, etc being passed down. That causes the component to be coupled withkeyHandler
if all you want to do is fire a callback that is on theprops
object. A way around this would be to allow anonKeyHandle
parameter be passed tokeyHandler
that could look like(ownProps, keyValue, keyEventName) => void
or something akin to that.Just want to open the discussion of any pros/cons of this approach
Here's an example:
This 2nd parameter to
keyHandler
would only be fired whenenter
would be pressed