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
2.99k stars 594 forks source link

Fix screen measurement when scrollWidth is a float #1055

Closed carbonrobot closed 2 months ago

carbonrobot commented 2 months ago

Fix screen measurement when scrollWidth is a float

The scrollWidth of a container is a rounded float value that causes the measurement to incorrectly round up when using Math.ceil if the container's actual size is +/- some small value.

This uses Math.round for the page calculation when using screen to avoid this problem and adds test coverage for the useMeasurement hook.

Actual Code fix: https://github.com/FormidableLabs/nuka-carousel/pull/1055/files#diff-d7aa6b5d278c998ec50a4b1441434b2e91b6a23af75fcd2ab8ddec4fff44aa14L30

changeset-bot[bot] commented 2 months ago

🦋 Changeset detected

Latest commit: 16cd0ddfee8c307b9dc768ad6b4f773caf85f315

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ------------- | ----- | | nuka-carousel | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

vercel[bot] commented 2 months ago

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

Name Status Preview Comments Updated (UTC)
nuka-carousel-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 8, 2024 8:09pm