Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix users stucks on rangesliedr tabbing the form #172

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/Rangeslider.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const constants = {

class Slider extends Component {
static propTypes = {
ariaLabel: PropTypes.string,
min: PropTypes.number,
max: PropTypes.number,
step: PropTypes.number,
Expand Down Expand Up @@ -167,19 +168,20 @@ class Slider extends Component {
* @return {void}
*/
handleKeyDown = e => {
e.preventDefault()
const { keyCode } = e
const { value, min, max, step, onChange } = this.props
let sliderValue

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
Expand Down Expand Up @@ -287,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
Expand Down Expand Up @@ -342,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}
Expand Down