sghall / react-compound-slider

:black_medium_small_square: React Compound Slider | A small React slider with no opinion on markup or styles
https://react-compound-slider.netlify.com
MIT License
626 stars 80 forks source link

onSlideStart is not called when drag starts from track click #112

Open jschen5 opened 4 years ago

jschen5 commented 4 years ago

Problem or feature description:

onSlideStart is not called if the drag starts from clicking on the track or rail.

Steps to reproduce (for problems):

Bind an onSlideStart and onSlideEnd handler on a slider. Clicking on the rail or track does not call onSlideStart, but it does call onSlideEnd. This seems to be because onSlideStart is only called onMouseDown of a handle, even though a drag can start from the track itself.

Possible solution:

Not sure what the best thing to do here is, but I feel like we could just call onSlideStart in the track/rail click handler once we've moved the handles here.

Versions (for problems):

React-Compound-Slider: 2.5.0 (and most likely 3.0.0-beta.1)

jschen5 commented 4 years ago

Made a PR that adds this behavior #113

sghall commented 4 years ago

Ahh, I see. I just looked at the PR. Yeah, I get what you're saying. I'll take a look at this.

jschen5 commented 4 years ago

Just saw the comment you left in #113. That makes sense! I'll update the pr and fork one of the demos as well.