Error Cannot read property 'contains' of undefined on dropdown sidebar menu

264 Views Asked by At

When clicking the sidebar navigation link drop-down toggle instead of showing the drop-down list of items, I'm getting this error:

Uncaught TypeError: Cannot read property 'contains' of undefined
    at sidebar.js:369
    at Array.forEach (<anonymous>)
    at t.n._toggleDropdown (sidebar.js:367)
    at HTMLAnchorElement.<anonymous> (sidebar.js:497)
    at HTMLDivElement.i (event-handler.js:116)

Checking the console the line that is generating the error is:

if (Default.dropdownAccordion === true) {
      this._getAllSiblings(toggler.parentElement).forEach(element => {
        if (element !== toggler.parentNode) {
          if (element.classList.contains(CLASS_NAME_NAV_DROPDOWN)) { // line 369
            element.classList.remove(CLASS_NAME_SHOW)
          }
        }
      })
    }

I'm using CoreUI (v3.2.0). When I was looking for a solution I found that this could be a problem related to having different versions of the template but I have no idea how to fix it.

0

There are 0 best solutions below