Skip to content

Commit

Permalink
[Infra UI] Auto focus search bar when page mounts for accessibility (#…
Browse files Browse the repository at this point in the history
…31758) (#31972)

* Fixes #28154 - Auto focus search bar when page mounts

* Adding check
  • Loading branch information
simianhacker authored Feb 25, 2019
1 parent d530855 commit 3199c60
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ export class AutocompleteField extends React.Component<
);
}

public componentDidMount() {
if (this.inputElement) {
this.inputElement.focus();
}
}

public componentDidUpdate(prevProps: AutocompleteFieldProps, prevState: AutocompleteFieldState) {
const hasNewValue = prevProps.value !== this.props.value;
const hasNewSuggestions = prevProps.suggestions !== this.props.suggestions;
Expand Down

0 comments on commit 3199c60

Please sign in to comment.