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.02k stars 597 forks source link

fix: add slide-visible classes appropriately when slideIndex has fractional digits #947

Closed fritz-c closed 1 year ago

fritz-c commented 1 year ago

Description

When the slideIndex has fractional digits (e.g., 0.5, 1.2), slide-visible classes are not being applied correctly.

Bug demo: click on next until you reach the end of the carousel and check slide 3's classes. It is missing slide-visible even though it is visible.

This PR fixes that.

Type of Change

How Has This Been Tested?

I added unit tests for the isSlideVisible function.

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
nuka-carousel ✅ Ready (Inspect) Visit Preview Aug 3, 2022 at 5:33PM (UTC)