From 8c804649727e3555a643e1193b0d1ea63142adf4 Mon Sep 17 00:00:00 2001 From: Leslie Lawendel Date: Mon, 2 Oct 2023 14:23:13 +0200 Subject: [PATCH] fix(blur-callback): call onBlur only if input loses focus (#510) --- src/Geosuggest.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Geosuggest.tsx b/src/Geosuggest.tsx index 59676f4..394d587 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 { @@ -438,9 +441,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,