Skip to content

Commit

Permalink
trigger menu open when focus only when having result(s)
Browse files Browse the repository at this point in the history
  • Loading branch information
zlatanpham authored and Benjamin Hinchley committed Sep 9, 2019
1 parent 1a797ac commit a66d1af
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ export class Input extends React.PureComponent<InputProps, InputState> {
public render() {
return (
<Search
getA11yStatusMessage={() => ""}
stateReducer={this.stateReducer}
key={`sj-downshift-${this.props.defaultValue}`}
defaultInputValue={this.props.defaultValue}
Expand Down Expand Up @@ -164,9 +163,10 @@ export class Input extends React.PureComponent<InputProps, InputState> {
autoCorrect: "off",
maxLength: 2048,
onFocus: event => {
openMenu();
if (Array.isArray(results) && results.length > 0) {
openMenu();
}
this.setState(state => ({ ...state, focused: true }));

typeof this.props.onFocus === "function" &&
this.props.onFocus(event);
},
Expand Down

0 comments on commit a66d1af

Please sign in to comment.