Closed brandonaaron closed 4 years ago
I also would love onAfterChange
to be triggered after every change. onChange
triggers too often for some controlled-scenarios in which only the end result matters, where onAfterChange
would be perfect. Although, now onAfterChange
is rather useless, because it does not guarantee to capture all user interactions.
At the same time, onSliderClick
returns only one value even if slider contains multiple handles. It is less useful than receiving new value, because it is hard to tell which handle did change.
There is a workaround though @brandonaaron , you can bind to onSliderClick
and use ReactSlider.getValue
.
@stonebk I think one of these scenarios would be worth considering:
onAfterChange
right after onChange
at onSliderMouseDown
- so adding onAfterChange
to slider track click, which is breaking changeonSliderClick
- it is also breaking change, but I cannot think of any use scenario of onSliderClick
right nowonSliderClick
- it is not a breaking change, but it's kinda tech debt in my opinionThanks for the workaround idea. I ended up using that for now.
Passing the whole value as the second parameter of onSliderClick
makes the most sense to me with the priority of reducing breaking changes. I agree it is tech debt but probably better to take that on, rather than deal with breaking stuff.
Description
Clicking directly on the track will trigger an
onChange
event but does not triggeronBeforeChange
noronAfterChange
.CodeSandbox
This can be seen on the docs but also reproduced in the code sandbox.