davidjerleke / embla-carousel

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

Loop + scrollTo with jump occasionally fails and selected slide turns white #652

Closed dlhagstroem closed 5 months ago

dlhagstroem commented 6 months ago

Bug is related to

Embla Carousel version

Describe the bug

Selected slide sometimes turns white when using emblaApi.scrollTo(index, true).

Prerequisites:

  1. Use option loop: true when initiating carousel
  2. Call scrollTo function with jump: true

CodeSandbox

https://xtcdzj.csb.app/

Steps to reproduce

  1. Click on thumbnail in the end
  2. Click thumbnail in the start
  3. Repeat until step 4
  4. See that selected slide occasionally turns white

Expected behavior

Show selected image (slide)

Additional context

Seems to be related to the loop option some how, when carousel "takes the closest way" to the selected index.

davidjerleke commented 6 months ago

Hi @dlhagstroem,

Thanks for your complete bug report. I will look into this when I get the chance.

Best, David

davidjerleke commented 6 months ago

@dlhagstroem can you reproduce the bug in this CodeSandbox? Thanks in advance!

dlhagstroem commented 5 months ago

@davidjerleke I gave it a hard round and no - I could not reproduce the issue in the provided sandbox :)

davidjerleke commented 5 months ago

@dlhagstroem thank you for testing it 👍🏻. I will release a patch including the bug fix then. Stay tuned.

Best, David

davidjerleke commented 5 months ago

@dlhagstroem a bug fix for this was just released in v8.0.0-rc19.