ribute('aria-selected', 'true')
          tab.removeAttribute('tabindex')
          tabpanels[i].classList.remove('tabpanel--hidden')

          if (setFocus) {
            tab.focus()
          }
        }

        else {
          tab.setAttribute('aria-selected', 'false')
          tab.tabIndex = -1
          tabpanels[i].classList.add('tabpanel--hidden')
        }
      })
    }

    function setSelectedToPreviousTab(currentTab) {
      const index = tabs.indexOf(currentTab)
      setSelectedTab(index =