react-key-navigation icon indicating copy to clipboard operation
react-key-navigation copied to clipboard

Add functionality to support keys outside of directional arrows and enter button.

Open sixfngers opened this issue 6 years ago • 2 comments

The main use case for this functionality is the ability to map a key like the escape button the functionality of a home or back button on a TV remote.

sixfngers avatar Mar 29 '19 21:03 sixfngers

is this working?

s4ngu3 avatar Jan 14 '21 22:01 s4ngu3

It works for me. When the focus is on the search bar, pressing the space key or esc key (called out in my commit) will console log a supported key was pressed.

because the feature code is not merged into dead/react-key-navigation repo npm install on the example writes the original repo files into node_modules. If you pull the code from my pull request build the react-key-navigation code and replace examples/youtube-react-tv/node_modules/react-key-navigation/build/ folder with react-key-navigation/build and run the example you will see the console log as stated above.

Steps to get the custom key example running clone master cd to react-key-navigation npm install npm run-script build

cd examples/youtube-react-tv/ npm install replace "examples/youtube-react-tv/node_modules/react-key-navigation/build/" folder with the one you just built "react-key-navigation/build" npm run start-dev

open browser to view example, when the focus is on the search bar at the top, press space or esc and you will see the console log, (spacebar press does same action as enter, esc only has a console log)

sixfngers avatar Jan 30 '21 14:01 sixfngers