react-image-lightbox icon indicating copy to clipboard operation
react-image-lightbox copied to clipboard

FEATURE: Keyboard events callback

Open brunoccc opened this issue 5 years ago • 0 comments

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

brunoccc avatar Jun 11 '20 16:06 brunoccc