From b496e819a0b635d6d209f7b829d582631d74bcf5 Mon Sep 17 00:00:00 2001 From: "Joseph J. Schmitt" Date: Wed, 28 Jun 2017 14:02:31 -0400 Subject: [PATCH] Ignore input change events that happen when the field is blurred (#67) This was leading to a situation where the suggestions would show if you changed the query from outside the omnibox, since `onInputChange` fires when the query changes. --- package.json | 2 +- src/angularComponent/ngcOmniboxController.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 76962b4..079b4d8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ngc-omnibox", - "version": "0.5.0", + "version": "0.5.1", "description": "A modern, flexible, Angular 1.x autocomplete library with limited assumptions.", "main": "dist/ngc-omnibox.js", "scripts": { diff --git a/src/angularComponent/ngcOmniboxController.js b/src/angularComponent/ngcOmniboxController.js index 71b3896..afb2be0 100644 --- a/src/angularComponent/ngcOmniboxController.js +++ b/src/angularComponent/ngcOmniboxController.js @@ -523,7 +523,8 @@ export default class NgcOmniboxController { this.hint = null; } - if (this.canShowSuggestions({query: this.query, omnibox: this}) !== false) { + const isFieldFocused = this.doc.activeElement === this._fieldElement; + if (isFieldFocused && this.canShowSuggestions({query: this.query, omnibox: this}) !== false) { this.updateSuggestions(); } }