Skip to content

Commit

Permalink
Fixed switch
Browse files Browse the repository at this point in the history
  • Loading branch information
yuri-sakharov committed Dec 17, 2017
1 parent ae26bf8 commit 2f6f2dc
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,14 +443,14 @@ class Select extends React.Component {
event.preventDefault();
this.popValue();
}
return;
break;
case 9: // tab
if (event.shiftKey || !this.state.isOpen || !this.props.tabSelectsValue) {
return;
break;
}
event.preventDefault();
this.selectFocusedOption();
return;
break;
case 13: // enter
event.preventDefault();
event.stopPropagation();
Expand All @@ -459,8 +459,7 @@ class Select extends React.Component {
} else {
this.focusNextOption();
}
return;
break;
break;
case 27: // escape
if (this.state.isOpen) {
this.closeMenu();
Expand All @@ -469,49 +468,49 @@ class Select extends React.Component {
this.clearValue(event);
event.stopPropagation();
}
break;
break;
case 32: // space
if (this.props.searchable) {
return;
break;
}
event.preventDefault();
if (!this.state.isOpen) {
this.focusNextOption();
return;
break;
}
event.stopPropagation();
this.selectFocusedOption();
break;
break;
case 38: // up
this.focusPreviousOption();
break;
break;
case 40: // down
this.focusNextOption();
break;
break;
case 33: // page up
this.focusPageUpOption();
break;
break;
case 34: // page down
this.focusPageDownOption();
break;
break;
case 35: // end key
if (event.shiftKey) {
return;
break;
}
this.focusEndOption();
break;
break;
case 36: // home key
if (event.shiftKey) {
return;
break;
}
this.focusStartOption();
break;
break;
case 46: // delete
if (!this.state.inputValue && this.props.deleteRemoves) {
event.preventDefault();
this.popValue();
}
return;
break;
default: return;
}
event.preventDefault();
Expand Down

0 comments on commit 2f6f2dc

Please sign in to comment.