From 9e28b5f2e6c3b39ee318ab43512d413a323bd9df Mon Sep 17 00:00:00 2001 From: Leslie Zimmermann Date: Wed, 9 Aug 2023 14:10:30 +0200 Subject: [PATCH] fix(blur-callback): call onBlur only if input loses focus --- src/Geosuggest.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Geosuggest.tsx b/src/Geosuggest.tsx index 417643c..ed27c13 100644 --- a/src/Geosuggest.tsx +++ b/src/Geosuggest.tsx @@ -219,6 +219,9 @@ export default class GeoSuggest extends React.Component { if (!this.state.ignoreBlur) { this.hideSuggests(); } + if (this.props.onBlur) { + this.props.onBlur(this.state.userInput); + } } onNext(): void { @@ -436,9 +439,6 @@ export default class GeoSuggest extends React.Component { * Hide the suggestions */ hideSuggests(): void { - if (this.props.onBlur) { - this.props.onBlur(this.state.userInput); - } this.timer = window.setTimeout(() => { this.setState({ activeSuggest: null,