Skip to content

Commit

Permalink
fix(blur-callback): call onBlur only if input loses focus
Browse files Browse the repository at this point in the history
  • Loading branch information
plumdumpling committed Aug 9, 2023
1 parent bfd0517 commit 9e28b5f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Geosuggest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ export default class GeoSuggest extends React.Component<Props, State> {
if (!this.state.ignoreBlur) {
this.hideSuggests();
}
if (this.props.onBlur) {
this.props.onBlur(this.state.userInput);
}
}

onNext(): void {
Expand Down Expand Up @@ -436,9 +439,6 @@ export default class GeoSuggest extends React.Component<Props, State> {
* Hide the suggestions
*/
hideSuggests(): void {
if (this.props.onBlur) {
this.props.onBlur(this.state.userInput);
}
this.timer = window.setTimeout(() => {
this.setState({
activeSuggest: null,
Expand Down

0 comments on commit 9e28b5f

Please sign in to comment.