Skip to content

Commit

Permalink
fix: account for floating point operations when stepping values with …
Browse files Browse the repository at this point in the history
…the keyboard

Fixes #179
  • Loading branch information
Brian Stone authored and stonebk committed Jun 15, 2020
1 parent 3f30cec commit 93f89d8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/ReactSlider/ReactSlider.jsx
Expand Up @@ -727,13 +727,13 @@ class ReactSlider extends React.Component {

moveUpByStep(step = this.props.step) {
const oldValue = this.state.value[this.state.index];
const newValue = oldValue + step;
const newValue = this.trimAlignValue(oldValue + step);
this.move(Math.min(newValue, this.props.max));
}

moveDownByStep(step = this.props.step) {
const oldValue = this.state.value[this.state.index];
const newValue = oldValue - step;
const newValue = this.trimAlignValue(oldValue - step);
this.move(Math.max(newValue, this.props.min));
}

Expand Down

0 comments on commit 93f89d8

Please sign in to comment.