FormidableLabs / nuka-carousel

Small, fast, and accessibility-first React carousel library with an easily customizable UI and behavior to fit your brand and site.
https://commerce.nearform.com/open-source/nuka-carousel
Other
3.07k stars 595 forks source link

Current (active) slide should have an indicator class applied #914

Closed zdolin closed 2 years ago

zdolin commented 2 years ago

Bugs and Questions

Describe Your Environment

Describe the Problem

Codesandbox: https://codesandbox.io/s/cranky-sea-j5uszw

Expected behavior: Current (active) slide should have an indicator class applied (".slide-current" or similar). Actual behavior: No special classes are applied to the current slide besides ".slide .slide-visible", which doesn't distinguish it from any of the others. Therefore, there's no way to tell programmatically (from what I can tell) what the current slide is, or apply special styling for the active/current slide.

Also note that wrapAround behavior is buggy when scrolling left (observable when clicking Prev a few times).

Thanks!

zdolin commented 2 years ago

Note this occurs when using the following combination of props (see codesandbox above):

{
  wrapAround={true}
  animation="zoom"
  slidesToShow={6}
  cellAlign="center"
}

I think the key issue is slidesToShow being greater than 1, which means multiple slides are visible at once and therefore it cannot be distinguished which is the active slide.

ValGeorgiev commented 2 years ago

Hey @zdolin thanks for raising this with us. It sounds easy to fix, I will prepare something today 🤞

zdolin commented 2 years ago

@ValGeorgiev great, thank you so much! Did you see my note about the wrapAround behavior as well? I can log a separate ticket for that, if you'd prefer.

ValGeorgiev commented 2 years ago

@zdolin Yes, another issue with sandbox will do the job. Thanks

ValGeorgiev commented 2 years ago

This should be fixed in v5.1.3

zdolin commented 2 years ago

Excellent - when is that planned for release?

ValGeorgiev commented 2 years ago

@zdolin It's already released. v5.1.3 should be in npm :)