richardscarrott / react-snap-carousel

DOM-first, headless carousel for React
https://richardscarrott.github.io/react-snap-carousel/
MIT License
306 stars 13 forks source link

Feature Req: arrow key support #30

Closed acroyear closed 1 month ago

acroyear commented 1 month ago

It looks pretty sharp, but it could use built-in arrow key support. left-right for horizontal, up-down for vertical layout.

The reason isn't just supporting mouseless desktops, but also TV type apps where the remote control is primarily a 5-button (up down left right enter) setup.

richardscarrott commented 1 month ago

TBH I don't know if it's worth offering it out-the-box as it's fairly easy to add yourself with useKeypress hooks etc -- also, I expect if you're building for a TV you have a good keyboard abstraction anyway. Unless perhaps there's more complexity than I recognise?

Aside, there is an example of arrow controls on the slideshow story here which I think work okay?

https://github.com/richardscarrott/react-snap-carousel/blob/0dedb640af97eb262cb6e21ce7858280e5b82ed4/stories/slideshow.tsx#L44

https://richardscarrott.github.io/react-snap-carousel/?path=/story/slideshow--scroll-padding

richardscarrott commented 1 month ago

Closing as can be done in user land.