From bbad61b97c483a2d4e2a153c2e1b10d21edaa1e0 Mon Sep 17 00:00:00 2001
From: Clement Ho <ClemMakesApps@gmail.com>
Date: Wed, 7 Dec 2016 12:54:29 -0600
Subject: [PATCH] Fix Droplab

---
 app/assets/javascripts/droplab/droplab.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/app/assets/javascripts/droplab/droplab.js b/app/assets/javascripts/droplab/droplab.js
index 6befa0976d4..84cd89297ff 100644
--- a/app/assets/javascripts/droplab/droplab.js
+++ b/app/assets/javascripts/droplab/droplab.js
@@ -212,7 +212,8 @@ require('./window')(function(w){
         var self = this;
         window.addEventListener('click', function(e){
           var thisTag = e.target;
-          if(thisTag.tagName === 'LI' || thisTag.tagName === 'A'){
+          if(thisTag.tagName === 'LI' || thisTag.tagName === 'A'
+             || thisTag.tagName === 'BUTTON'){
             // climb up the tree to find the UL
             thisTag = utils.closest(thisTag, 'UL');
           }
@@ -556,7 +557,7 @@ var camelize = function(str) {
 };
 
 var closest = function(thisTag, stopTag) {
-  while(thisTag.tagName !== stopTag && thisTag.tagName !== 'HTML'){
+  while(thisTag !== null && thisTag.tagName !== stopTag && thisTag.tagName !== 'HTML'){
     thisTag = thisTag.parentNode;
   }
   return thisTag;
-- 
2.30.9