NoriginMedia / Norigin-Spatial-Navigation

React Hooks based Spatial Navigation (Key & Remote Control Navigation) / Web Browsers, Smart TVs and Connected TVs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A suggestion about keycode mapping

naygomes opened this issue · comments

Hello.
I'm Nayara, I work with developing experiences for hybrid TV and in the last days I had some problemas about spacial navigation.
All experiences that my team develops are tested in a setup with TVs from different manufacturers, each with a different OS. On one of these TVs, spatial navigation wasn't working because it doesn't receive the value of the event.keyCode attribute or event.code, it only receives event.key.
So, I went into the SpatialNavigation.ts file and noticed that the following function:

static getKeyCode(event: KeyboardEvent) {
     return event.keyCode || event.code;
}

By changing this function by adding the event.key attribute, spatial navigation worked on all TVs, with the function being as follows:

static getKeyCode(event: KeyboardEvent) {
     return event.keyCode || event.code || event.key;
}

However, as when deploying, the entire package is installed again, this change is lost and continues to not work in production.
Therefore, I wanted to know if it would be possible to add this feature in the next update to make spatial navigation also based on event.key.

Thank you in advance.

Thank you @naygomes for your suggestion. I've just open a PR to include this change on next releases.

Thanks for answering me. Can you tell me when this change is released?