From 611480ab3bc4962dfa5700f305ce79f37c972d2b Mon Sep 17 00:00:00 2001 From: Simon Babay Date: Mon, 1 Aug 2016 15:36:29 +0200 Subject: [PATCH] (select-one) search = false, on blur hide dropdown --- assets/scripts/src/choices.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/assets/scripts/src/choices.js b/assets/scripts/src/choices.js index 5a55d61..773ebf5 100644 --- a/assets/scripts/src/choices.js +++ b/assets/scripts/src/choices.js @@ -1600,6 +1600,10 @@ export class Choices { if(this.passedElement.type && this.passedElement.type === 'select-one') { this.containerOuter.addEventListener('focus', this._onFocus); + + if(!this.canSearch) { + this.containerOuter.addEventListener('blur', this._onBlur); + } } this.input.addEventListener('input', this._onInput); @@ -1621,6 +1625,10 @@ export class Choices { if(this.passedElement.type && this.passedElement.type === 'select-one') { this.containerOuter.removeEventListener('focus', this._onFocus); + + if(!this.canSearch) { + this.containerOuter.removeEventListener('blur', this._onBlur); + } } this.input.removeEventListener('input', this._onInput);