NoriginMedia / react-spatial-navigation

DEPRECATED. HOC-based Spatial Navigation. NEW Hooks version is available here: https://github.com/NoriginMedia/norigin-spatial-navigation
MIT License
226 stars 64 forks source link

More info about pressed keys on events #55

Closed salvan13 closed 4 years ago

salvan13 commented 4 years ago

I am trying to add more info about pressed keys in the spatial navigation on the functions onEnterPress and onArrowPress. It's a paramter called detail:

{
  pressedKeys: {
    [KEY]: number
  }
}

the pressedKeys property contains the pressed keys in the moment the function is called, the number represent how many times the keydown event is fired before releasing it (while pressing a key, multiple keydown events are fired and when the key is released a keyup event is fired, that number represent the number of keydowns on the same key before the keyup happens)

With those info we can discard unwanted events, they could be useful also to implement long press.