Skip to content

Commit

Permalink
Fixed #10
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Apr 10, 2017
1 parent 53a4231 commit cef8df7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/components/autocomplete/AutoComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class AutoComplete extends Component {

constructor(props) {
super(props);
this.state = {panelVisible: false};
this.state = {panelVisible: false, focus: false};
}

onInput(event) {
Expand Down Expand Up @@ -142,7 +142,7 @@ export class AutoComplete extends Component {
}

show() {
if(!this.state.panelVisible && (this.focus||this.dropdownFocus)) {
if(!this.state.panelVisible && (this.state.focus||this.dropdownFocus)) {

this.setState({panelVisible: true});
this.panel.style.zIndex = DomHandler.getZindex();
Expand Down Expand Up @@ -280,7 +280,7 @@ export class AutoComplete extends Component {
}

onInputFocus(event) {
this.focus = true;
this.setState({focus: true});
if(this.props.onFocus) {
this.props.onFocus({
originalEvent: event
Expand All @@ -303,7 +303,7 @@ export class AutoComplete extends Component {
}

onBlur() {
this.focus = false;
this.setState({focus: false});
}

onDropdownFocus() {
Expand Down Expand Up @@ -381,7 +381,7 @@ export class AutoComplete extends Component {

componentWillReceiveProps(nextProps) {
var newSuggestions = nextProps.suggestions;
if (newSuggestions && this.focus) {
if (newSuggestions && this.state.focus) {
this.suggestions = newSuggestions;
if(this.suggestions && this.suggestions.length) {
this.show();
Expand Down Expand Up @@ -413,7 +413,8 @@ export class AutoComplete extends Component {

if(this.props.multiple) {
var multipleContainerClass = classNames("ui-autocomplete-multiple-container ui-widget ui-inputtext ui-state-default ui-corner-all", {
'ui-state-disabled': this.props.disabled
'ui-state-disabled': this.props.disabled,
'ui-state-focus': this.state.focus
}),
multipleContainer = (
<ul ref={(el) => {this.multipleContainerEl = el}} className={multipleContainerClass}>
Expand Down

0 comments on commit cef8df7

Please sign in to comment.