ment.getElementById(tab.getAttribute('aria-controls'))
      tab.tabIndex = -1
      tab.setAttribute('aria-selected', 'false')
      tab.addEventListener('keydown', onKeydown)
      tab.addEventListener('click', onClick)

      if (!firstTab) {
        firstTab = tab
      }

      lastTab = tab

      return tabpanel
    })

    setSelectedTab(firstTab, false)

    function setSelectedTab(currentTab, setFocus = true) {
      tabs.forEach((tab, i) => {
        if (currentTab === tab) {
          tab.setAtt