davidjerleke / embla-carousel

A lightweight carousel library with fluid motion and great swipe precision.
https://www.embla-carousel.com
MIT License
5.49k stars 167 forks source link

When Embla falls back to `loop: false` it replaces the user provided loop option #414

Closed davidjerleke closed 1 year ago

davidjerleke commented 1 year ago

Bug is related to

Embla Carousel version

Describe the bug

  1. Initialize Embla with not enough slide content for the loop effect to work.
  2. Embla makes the decision that the carousel doesn’t have enough slide content for the loop effect to work. So it automatically falls back to loop: false.
  3. Change the slide content so it's enough to loop.
  4. Run reInit().
  5. When falling back to loop: false, Embla replaces the user provided loop option which was loop: true.
  6. So from now on every reInit() call without the options parameter will be with loop: false.
  7. What Embla should do is that it should reset the user provided loop option to loop: true after falling back to loop: false, which happens when when slide content isn’t enough for the loop effect to work.
  8. So the next time reInit() is called, Embla should try loop: true again.

Expected behavior

Additional context

Thanks @pReya for reporting this bug. Discussed in: