Skip to content

Commit

Permalink
fix: prevent snap back issue on mobile
Browse files Browse the repository at this point in the history
If `preventDefault` isn't called touch event propogates through to mouse
event and `onSliderMouseDown` is called. This in turn calls
`forceValueFromPosition` which can regularly cause thumb to snap back
at the end of touch event.
  • Loading branch information
njdancer-am committed Nov 17, 2022
1 parent 33a7898 commit 107e2bb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/ReactSlider/ReactSlider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,8 @@ class ReactSlider extends React.Component {
this.onEnd(this.getMouseEventMap());
};

onTouchEnd = () => {
onTouchEnd = e => {
e.preventDefault();
this.onEnd(this.getTouchEventMap());
};

Expand Down

0 comments on commit 107e2bb

Please sign in to comment.