Skip to content

Commit

Permalink
Merge pull request #1837 from karaggeorge/tab-focus-bug
Browse files Browse the repository at this point in the history
Prevent default event from firing on Tab and Enter press
  • Loading branch information
JedWatson authored Oct 27, 2017
2 parents 6a017ea + 00b25df commit 572dd50
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,15 +381,18 @@ class Select extends React.Component {
if (event.shiftKey || !this.state.isOpen || !this.props.tabSelectsValue) {
return;
}
event.preventDefault();
this.selectFocusedOption();
return;
case 13: // enter
if (!this.state.isOpen) {
event.preventDefault();
event.stopPropagation();
if (this.state.isOpen) {
this.selectFocusedOption();
} else {
this.focusNextOption();
return;
}
event.stopPropagation();
this.selectFocusedOption();
return;
break;
case 27: // escape
if (this.state.isOpen) {
Expand Down

0 comments on commit 572dd50

Please sign in to comment.