Skip to content

Commit

Permalink
slider: fix scrolling on key nav (#471)
Browse files Browse the repository at this point in the history
  • Loading branch information
chaance committed Feb 14, 2020
1 parent 0788b26 commit 8066f3b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions packages/slider/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ export const SliderInput = forwardRef<HTMLDivElement, SliderInputProps>(
[isVertical, max, min, step]
);

const handleKeyDown = wrapEvent(onKeyDown, function(event) {
const handleKeyDown = wrapEvent(onKeyDown, event => {
let flag = false;
let newValue;
const tenSteps = (max - min) / 10;
Expand Down Expand Up @@ -371,13 +371,11 @@ export const SliderInput = forwardRef<HTMLDivElement, SliderInputProps>(
}

if (flag) {
// event.preventDefault();
// event.stopPropagation();
event.preventDefault();
newValue = roundValueToStep(newValue, keyStep);
newValue = getAllowedValue(newValue, min, max);
updateValue(newValue);
}

newValue = roundValueToStep(newValue, keyStep);
newValue = getAllowedValue(newValue, min, max);
updateValue(newValue);
});

const handlePointerDown = wrapEvent(onPointerDown, event => {
Expand Down

0 comments on commit 8066f3b

Please sign in to comment.