embla-carousel: scrollTo's scroll direction is inconsistent

what I tried

Applying embla.scrollTo(1) to the carousel having only two slides. (and loop: true)

codesandbox demo

what I expected

New slide should appear from the right side.

what I got

New slide appears from the left side only the first time. This doesn’t occur with more than 3 elements.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (7 by maintainers)

Most upvoted comments

@davidjerleke that’s exactly what I was trying to achieve, thanks so much!

thanks for the information @davidjerleke

Hello again @jeiea,

You’re right. It should be LRLR. Flipping the comparisons on this line seems to do the trick but I haven’t had the time to figure out why yet.

You’re welcome to dig further if you want to solve it and make a contribution.

As mentioned earlier I don’t think this breaks any functionality and it’s an edge case (only happens with 2 slides) so I’m not going to prioritize it among other things to do right now. I hope you understand my reasoning. With that said, I appreciate you taking time creating a clear issue demonstrating this.

Best, David