When using dropdown it closes navbar

Hi. I have a dropdown menu inside my nav bar, and on the smaller screen sizes, the nav bar gets collapsed (using a BSS template here), then when I open the nav bar and want to open the dropdown, the entire nav bar closes. I have tried this on a fresh protect and for some reason I still have that problem. Any help would be appreciated.

I fixed it by adding this code in the for loop. `

      item.addEventListener('click', function (event) { 
      var isDropdownItem = this.closest('.dropdown');

      if (!isDropdownItem) {
        collapse.hide();
      }

    });`

It basically checks if the clicked item is a dropdown item and if it is not it behaves normally.