Does moveThreshold actually work?
dkadrios opened this issue · comments
pure-react-carousel
version: 1.27.6react
version: 17.0.2browser
used: Chrome 89node
version: 12.14.1
Perhaps I'm misunderstanding the role of moveThreshold
, or possibly it's not working correctly. When clicking on slides 'sloppily', it's possible to make the whole slider jiggle a bit if you happened to drag a bit during the mouse click. I figured increasing moveThreshold
would make it so you'd need to drag a bit further before the slider started to respond, but that doesn't seem to be happening, regardless of how high I adjust the value.
<Slider moveThreshold={2.0}>
Is this what moveThreshold
is meant to do? Is there another way to decrease these accidental drags?
Hello @dkadrios!
This is a good question, the moveThreshold
prop on the <Slider />
component controls the pixel threshold of movement during "small drag events" compared to the size of the slides. It works complimentary with the dragStep
prop on the <CarouselProvider />
. We have logic that is used to determine if the drag event is a "big drag" or "small drag", and big drags are not prevented by the moveThreshold
prop. We compare both these drag events to determine the current slide that should be shown.
It sounds like the functionality you are looking for is preventing any movement of the carousel unless the slides are dragged past a certain threshold, did I understand the issue correctly? If I have there is currently not a way to prevent carousel movement or locking in the current slide.
Would you accept a PR that adds a bool prop for this feature? I might also take a look at the infinite-mode wrap-around cloning issue as well.
On our side, we feel that locking the slide in place would be counter-intuitive to UX. We are unsure how a user would know that the carousel moves if there wasn't this feedback of the slider. We would however appreciate any PR, so if you had some time to take a look at issue #328 or other issues that would be great :). Additionally based on our discussion we will be reviewing the documentation in an attempt to prevent future confusion related to the moveThreshold
props.