glortho / glortho/react-keydown

Feature request: add @keyup and @keyupScoped decorators

Open
#32 1 comment 5 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
495
Forks
34
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.