Skip to content

Commit

Permalink
Fixed #963 - Add autoFocus attribute to Autocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Jul 19, 2019
1 parent e24afe4 commit d330c73
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/autocomplete/AutoComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class AutoComplete extends Component {
size: null,
appendTo: null,
tabindex: null,
autoFocus: false,
tooltip: null,
tooltipOptions: null,
completeMethod: null,
Expand Down Expand Up @@ -79,6 +80,7 @@ export class AutoComplete extends Component {
size: PropTypes.number,
appendTo: PropTypes.any,
tabindex: PropTypes.number,
autoFocus: PropTypes.bool,
tooltip: PropTypes.string,
tooltipOptions: PropTypes.object,
completeMethod: PropTypes.func,
Expand Down Expand Up @@ -477,6 +479,10 @@ export class AutoComplete extends Component {
}

componentDidMount() {
if (this.props.autoFocus && this.inputEl) {
this.inputEl.focus();
}

if (this.props.tooltip) {
this.renderTooltip();
}
Expand Down

0 comments on commit d330c73

Please sign in to comment.