leaffm / react-infinite-carousel

React simple infinite carousel with lazy loading and responsive support
MIT License
116 stars 19 forks source link

Arrows don't move Carousel position when cursor comes from inside it #29

Closed cdatehortuab closed 4 years ago

cdatehortuab commented 4 years ago

As the title says when you move your mouse cursor from inside the carousel to an arrow and immediately click on the arrow, it doesn't work.

To reproduce:

  1. Go to the sandbox here: https://codesandbox.io/s/dreamy-browser-bnfle
  2. Move your cursor over the carousel but not on the arrows.
  3. Move the cursor over an arrow and click it immediately.

You will see that the carousel doesn't move.

The cause of this probably is that in the <ul> tag on render function of the component, there is a listener for onMouseLeave event that is not prevented to be executed when the user is not dragging. (Probably the condition to attach this event and other event listeners related with drag is incorrect: should be dragging && !disableSwipeEvents and not the current dragging && !disableSwipeEvents)

cdatehortuab commented 4 years ago

@gl0gl0 Any update on this?

gl0gl0 commented 4 years ago

Hi @cdatehortuab ! Sorry I haven't get back to you until now. I'm gonna take a look at this, thanks for the thorough explanation of the bug :). I believe this just started happening after I updated some dependencies in the last version. Probably previous version works fine but dependencies are old. I'll get back as soon as I have an update on this.

gl0gl0 commented 4 years ago

This was fixed on version 2.0.3

Thanks @cdatehortuab the change of the flags from || to && did the trick. Not sure why I had an || before 🤔 but hopefully it won't impact on anything else 😄

cdatehortuab commented 4 years ago

¡Thanks!