From cff84dabb5ba3bf82a1b97157bbdcd084b48d9c5 Mon Sep 17 00:00:00 2001 From: LevshitsVV Date: Thu, 21 Oct 2021 12:59:17 +0300 Subject: [PATCH 1/2] fix users stucks on rangesliedr tabbing the form --- 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 From e9ef4048a65033b5752decdd6cf2f39aa04ea25b Mon Sep 17 00:00:00 2001 From: LevshitsVV Date: Thu, 21 Oct 2021 13:27:47 +0300 Subject: [PATCH 2/2] Aria-Label attribute --- src/Rangeslider.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Rangeslider.js b/src/Rangeslider.js index becfa6a..f95ba4c 100755 --- a/src/Rangeslider.js +++ b/src/Rangeslider.js @@ -28,6 +28,7 @@ const constants = { class Slider extends Component { static propTypes = { + ariaLabel: PropTypes.string, min: PropTypes.number, max: PropTypes.number, step: PropTypes.number, @@ -288,7 +289,8 @@ class Slider extends Component { labels, min, max, - handleLabel + handleLabel, + ariaLabel } = this.props const { active } = this.state const dimension = constants.orientation[orientation].dimension @@ -343,6 +345,7 @@ class Slider extends Component { onMouseUp={this.handleEnd} onTouchStart={this.handleStart} onTouchEnd={this.handleEnd} + aria-label={ariaLabel} aria-valuemin={min} aria-valuemax={max} aria-valuenow={value}