react-keydown icon indicating copy to clipboard operation
react-keydown copied to clipboard

Feature request: add @keyup and @keyupScoped decorators

Open acusti opened this issue 9 years ago • 1 comments

In my use case, I’d like to be able to toggle state based on if a modifier key is pressed, so it would be great to be able to do something like:

class MyComponent extends React.Component {

  @keydown('alt')
  setModeCopy(event) {
    this.setState({ mode: 'copy' });
  }

  @keyup('alt')
  setModeMove(event) {
    this.setState({ mode: 'move' });
  }
}

In actually use, I think I would use @keydownScoped and @keyupScoped.

acusti avatar Sep 02 '16 13:09 acusti

I could easily handle disabling key-repeat #30 with this feature.

gbishop avatar Sep 02 '16 17:09 gbishop