Skip to content

Commit

Permalink
fix(blur-callback): call onBlur only if input loses focus (#510)
Browse files Browse the repository at this point in the history
  • Loading branch information
plumdumpling committed Oct 2, 2023
1 parent f3cb836 commit 8c80464
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 @@ -438,9 +441,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 8c80464

Please sign in to comment.