From 9b9662ee999d8cf06a84d3e562459e1559901856 Mon Sep 17 00:00:00 2001 From: Josh Johnson Date: Wed, 16 Aug 2017 13:12:20 +0100 Subject: [PATCH] Utilise dropdown state --- assets/scripts/src/choices.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/assets/scripts/src/choices.js b/assets/scripts/src/choices.js index 2e4de2d..fdb64ef 100644 --- a/assets/scripts/src/choices.js +++ b/assets/scripts/src/choices.js @@ -1764,9 +1764,7 @@ class Choices { // We are typing into a text input and have a value, we want to show a dropdown // notice. Otherwise hide the dropdown if (this.isTextElement) { - const hasActiveDropdown = this.dropdown.element.classList.contains( - this.config.classNames.activeState, - ); + const hasActiveDropdown = this.dropdown.isActive; if (value) { if (canAddItem.notice) { @@ -1985,9 +1983,7 @@ class Choices { const target = e.target; // If target is something that concerns us if (this.containerOuter.contains(target)) { - const hasActiveDropdown = this.dropdown.element.classList.contains( - this.config.classNames.activeState, - ); + const hasActiveDropdown = this.dropdown.isActive; const focusActions = { text: () => { if (target === this.input) { @@ -2031,9 +2027,7 @@ class Choices { // If target is something that concerns us if (this.containerOuter.contains(target) && !this.isScrollingOnIe) { const activeItems = this.store.getItemsFilteredByActive(); - const hasActiveDropdown = this.dropdown.element.classList.contains( - this.config.classNames.activeState, - ); + const hasActiveDropdown = this.dropdown.isActive; const hasHighlightedItems = activeItems.some(item => item.highlighted); const blurActions = { text: () => {