0

I have a react component that's trying to pick up a shift + click on a component.

handleClick(e) {
  if (e.keyCode == 16) { 
    // do stuff
  }
}

render() {
  // ...

  <div onClick={this.handleClick}>
    // ...
  </div>

  // ...
}

For some reason the e.keyCode returns undefined so it never fires. But it works with e.shiftKey which returns true.

I use e.keyCode in plenty of other click events so is there any reason it wouldn't work with the SHIFT key (+ click) specifically?

Using Firefox 66.0.3. Thanks!

user2490003
  • 10,706
  • 17
  • 79
  • 155

0 Answers0