From a087424063bc2ce8f046bcda596000832fdd2d40 Mon Sep 17 00:00:00 2001
From: Chris Lawton <chris.lawton@torchbox.com>
Date: Tue, 20 Feb 2018 10:43:30 +0000
Subject: [PATCH] listen to select2 clear event so we can remove the is-active
 class

---
 opentech/static_src/src/javascript/main.js | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/opentech/static_src/src/javascript/main.js b/opentech/static_src/src/javascript/main.js
index 43010ef06..5f2d6a7b3 100755
--- a/opentech/static_src/src/javascript/main.js
+++ b/opentech/static_src/src/javascript/main.js
@@ -44,4 +44,10 @@ $(function () {
             match[0].classList.remove('is-active');
         }
     });
+
+    // remove active class on clearing select2
+    $('.select2').on('select2:unselecting', (e) => {
+        const dropdown = e.target.nextElementSibling.firstChild.firstChild;
+        (dropdown.classList.contains('is-active')) ? dropdown.classList.remove('is-active') : null;
+    });
 });
-- 
GitLab