Skip to content

Commit

Permalink
[fixed] multiselect calls preventDefault
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense committed Dec 8, 2015
1 parent 6e83098 commit 53bff60
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Multiselect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -423,18 +423,21 @@ var Multiselect = React.createClass({
else if (isOpen) this.setState({ focusedItem: prev, ...nullTag })
}
else if (key === 'End') {
e.preventDefault()
if ( isOpen ) this.setState({ focusedItem: list.last(), ...nullTag })
else tagList && this.setState({ focusedTag: tagList.last() })
}
else if (key === 'Home') {
e.preventDefault()
if (isOpen) this.setState({ focusedItem: list.first(), ...nullTag })
else tagList && this.setState({ focusedTag: tagList.first() })
}
else if (isOpen && key === 'Enter')
else if (isOpen && key === 'Enter') {
e.preventDefault();
(ctrlKey && this.props.onCreate) || focusedItem === null
? this._onCreate(this.props.searchTerm)
: this._onSelect(this.state.focusedItem)

}
else if (key === 'Escape')
isOpen ? this.close() : tagList && this.setState(nullTag)

Expand Down

0 comments on commit 53bff60

Please sign in to comment.