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
3k stars 596 forks source link

Carousel inside a flex column expands the column width #990

Closed marcomartinscastanho closed 1 year ago

marcomartinscastanho commented 1 year ago

Bugs and Questions

Prerequisites

Describe Your Environment

Describe the Problem

I have a page with 2 flex columns. One of the columns has a box where I want to have a Carousel. But the Carousel expands the width of the column.

https://codesandbox.io/s/vigorous-dawn-5twifm

Expected behavior:

With or without the Carousel, the column width should be the same.

Actual behavior

The column containing the Carousel expands.

fritz-c commented 1 year ago

Thank you for the very detailed repro in the sandbox. It made it much easier to troubleshoot. It appears the solution might not be in the library, but the CSS used in the surrounding layout. Adding overflow: hidden; to your column class seems to fix it: https://codesandbox.io/s/carousel-in-flex-fix-0y7z6n?file=/src/styles.css:391-410

marcomartinscastanho commented 1 year ago

Thank you very much! And sorry for reporting what ended up being a non-issue.