From 1cd65a5f5bcad4715c3b919a08538c419ae01a3f Mon Sep 17 00:00:00 2001 From: Jamie Bower Date: Thu, 19 May 2022 12:47:07 +1000 Subject: [PATCH] fix: only prevent default on key down when one of the arrow keys was pressed --- src/Rangeslider.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Rangeslider.js b/src/Rangeslider.js index 9bd8aa1..becfa6a 100755 --- a/src/Rangeslider.js +++ b/src/Rangeslider.js @@ -167,7 +167,6 @@ class Slider extends Component { * @return {void} */ handleKeyDown = e => { - e.preventDefault() const { keyCode } = e const { value, min, max, step, onChange } = this.props let sliderValue @@ -175,11 +174,13 @@ class Slider extends Component { switch (keyCode) { case 38: case 39: + e.preventDefault() sliderValue = value + step > max ? max : value + step onChange && onChange(sliderValue, e) break case 37: case 40: + e.preventDefault() sliderValue = value - step < min ? min : value - step onChange && onChange(sliderValue, e) break