akiran / react-slick

React carousel component
http://react-slick.neostack.com/
MIT License
11.72k stars 2.1k forks source link

`infinite` doesn't play nicely with `variableWidth` and `focusOnSelect` #1905

Open walmink opened 3 years ago

walmink commented 3 years ago

Intention

I am trying to create an infinite slider that will display a set of items, where the items have variable width and a click item gets focus on select (moves to left edge of slider component) when clicked.

Problem

In many (but not all cases), Slick React scrolls to cloned version of the clicked item, instead of the item itself. See example.

What's working:

What's not working:

(these lists are not exhaustive, obviously, just as an example)

rival14 commented 1 year ago

Try to add this css In my case it working because I set infinite true and set slidesToShow to more than length of image, so it will create cloned element and below css fixed my issue .slick-slide.slick-active.slick-cloned { display: none !important; }

moreginger commented 3 months ago

I just ran into this too. Very confusing. It makes focusOnSelect unusable with variableWidth, as it almost always scrolls through all the elements when trying to move forward a single index.

mustafakunwa commented 3 months ago

any solution for this i'm also facing this issue