Skip to content

Commit

Permalink
fix: the active thumb should get focus when a value is selected
Browse files Browse the repository at this point in the history
Giving the thumb focus allows the user to move from mouse control
to keyboard control.
  • Loading branch information
Brian Stone authored and stonebk committed Sep 27, 2019
1 parent ed67408 commit f1cc0cc
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/components/ReactSlider/ReactSlider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ class ReactSlider extends React.Component {

onEnd(eventMap) {
removeHandlers(eventMap);
this.setState({ index: -1 }, this.fireChangeEvent.bind(this, 'onAfterChange'));
this.fireChangeEvent.bind(this, 'onAfterChange');
}

onMouseMove = e => {
Expand Down Expand Up @@ -626,12 +626,8 @@ class ReactSlider extends React.Component {
}

start(i, position) {
const activeEl = document.activeElement;
const thumbRef = this[`thumb${i}`];
// if activeElement is body window will lost focus in IE9
if (activeEl && activeEl !== document.body && activeEl !== thumbRef && activeEl.blur) {
activeEl.blur();
}
thumbRef.focus();

this.hasMoved = false;

Expand Down

0 comments on commit f1cc0cc

Please sign in to comment.