react-image-lightbox
react-image-lightbox copied to clipboard
FEATURE: Keyboard events callback
I was wondering if we could add a callback for receiving keyboard events: each time the user presses a key, an (optional) callback is invoked and the client can perform the necessary operations.
Use cases are, for example, desktop applications where the user could rate a picture by pressing a number from 1 to 5, or flag somehow the photo with some other keys, or even jump to a specific picture in the list (e.g. next gallery).
I tried in many ways using the normal React functionalities, but it seems that the component is consuming the events and I can't get anything in my callback, so I thought to add a simple callback in the component props. I have a working version here: https://github.com/brunoccc/react-image-lightbox/commit/1b1e436fac8c905c920b21ecd85770f617216995 If you think it's a useful functionality, I can add tests/documentation and create a PR for it.
Bruno