embla-carousel icon indicating copy to clipboard operation
embla-carousel copied to clipboard

[Bug]: Slide hanging if overdragged/scrolled

Open DanielSpindler opened this issue 1 year ago • 11 comments

Which variants of Embla Carousel are you using?

  • [X] embla-carousel (Core)
  • [ ] embla-carousel-react
  • [ ] embla-carousel-vue
  • [ ] embla-carousel-svelte
  • [ ] embla-carousel-autoplay
  • [ ] embla-carousel-auto-scroll
  • [ ] embla-carousel-solid
  • [ ] embla-carousel-auto-height
  • [ ] embla-carousel-class-names
  • [ ] embla-carousel-docs (Documentation)
  • [ ] embla-carousel-docs (Generator)

Steps to reproduce

The bug occurs when I "overscroll/drag" the slides

i got an example sandbox https://codesandbox.io/p/sandbox/embla-carousel-default-react-ww73yq?file=%2Fsrc%2Fjs%2FEmblaCarouselArrowButtons.tsx from the docs and tried it there to reproduce.

https://github.com/davidjerleke/embla-carousel/assets/71325321/e76122c3-c6d6-4d2b-8763-1f00f24ad095

Expected Behavior

Jumping back

Additional Context

I have also tried : Google Chrome Firefox Safari

And also tried to implement a "overscroll" workaround from the issues which sadly jumped around, but not related.

I've searchd the issues and docs throughly and found nothing that could be directly related.

What browsers are you seeing the problem on?

No response

Version

v8.0.0

CodeSandbox

https://codesandbox.io/p/sandbox/embla-carousel-default-react-ww73yq?file=%2Fsrc%2Fjs%2FEmblaCarouselArrowButtons.tsx

Before submitting

  • [X] I've made research efforts and searched the documentation
  • [X] I've searched for existing issues
  • [X] I agree to follow this project's Contributing Guidelines for bug reports

DanielSpindler avatar Mar 05 '24 17:03 DanielSpindler

Hi @DanielSpindler,

This was reported by @sarussss here but I haven’t had the time to create a bug report:

  • https://github.com/davidjerleke/embla-carousel/discussions/777

Thanks for doing it for me.

Best, David

davidjerleke avatar Mar 05 '24 17:03 davidjerleke

Thanks alot and no Problem!

Greetings, Daniel

DanielSpindler avatar Mar 05 '24 17:03 DanielSpindler

hey guys, running into the same issue with the WheelGesturesPlugin here's a snippet that sort of fixes this issue:

 embalaApi.on('settle', (api: CarouselApi) => {
        if (!api) {
          return;
        }
        const { limit, location, scrollTo } = api.internalEngine();
        if (location.get() > limit.max) {
          scrollTo.index(0, 0);
        }
        if (location.get() < limit.min) {
          scrollTo.index(embalaApi.scrollSnapList().length - 1, 1);
        }
      });

Ideally it would be nice to reset the momentum early so it never gets to this or take so long to rubber band back.

chiumax avatar Apr 10 '24 06:04 chiumax

@DanielSpindler and/or @sarussss,

Can you reproduce this problem in this CodeSandbox?

davidjerleke avatar May 20 '24 08:05 davidjerleke

Hi @davidjerleke I checked, the problem I had before has been resolved, great!

sarussss avatar May 20 '24 14:05 sarussss

https://codesandbox.io/p/sandbox/embla-carousel-default-react-forked-vcjj84?file=%2Fsrc%2Fjs%2FEmblaCarouselArrowButtons.tsx updated the other CodeSandBox for now @davidjerleke, @sarussss seems like it is not gone, will update it in a live app today and give a feedback after

DanielSpindler avatar May 21 '24 07:05 DanielSpindler

@DanielSpindler did you try the CodeSandbox in this comment? Because a fix for this has not released yet!

davidjerleke avatar May 21 '24 07:05 davidjerleke

@davidjerleke my fault ive been reading it wrong sorry! do you have a version with "embla-carousel-wheel-gestures": "^8.0.0-rc05" cant reproduce with dragging anymore

DanielSpindler avatar May 21 '24 07:05 DanielSpindler

@DanielSpindler you can fork the CodeSandbox and add the Wheel Gestures plugin and test it if you want.

davidjerleke avatar May 21 '24 07:05 davidjerleke

@davidjerleke https://codesandbox.io/p/sandbox/bug-785-forked-psk7k8?file=%2Fsrc%2Fjs%2Fembla-carousel.js%3A1857%2C25-1857%2C30 seems to work just fine, cant reproduce anymore

DanielSpindler avatar May 21 '24 07:05 DanielSpindler

Thanks @sarussss and @DanielSpindler. I'll throw a comment in here once the bug fix has been released.

davidjerleke avatar May 21 '24 08:05 davidjerleke

A bug fix for this will be included in the next release.

davidjerleke avatar Jun 07 '24 19:06 davidjerleke

@sarussss and @DanielSpindler a bug fix for this was just released in v8.1.4.

davidjerleke avatar Jun 11 '24 11:06 davidjerleke