joystick icon indicating copy to clipboard operation
joystick copied to clipboard

Consider an API for keyboard events

Open rglover opened this issue 6 months ago • 1 comments

Technically the existing events API can do this but it's cumbersome. Would be good if you could just map keys to a function on a component. That way keyboard-commanded UIs are easy to build.

rglover avatar May 31 '25 17:05 rglover

Kind of like the API idea of having something like:

keyboard: [
  { key: 's', modifier: 'cmd|ctrl', handler: () => {} }
],

The idea being that you have an array of keyboard events that are either a single key or a key + modifier associated with a handler function that does something when that event is triggered.

Only real headache is either using short-hand modifier keys like cmd or command (or ctrl vs control). I think just spelling it out is more Joystick style and predictable.

rglover avatar Jun 13 '25 18:06 rglover