     if tabView? and not tabView.classList.contains('active')
       @querySelector('.tab.active')?.classList.remove('active')
       tabView.classList.add('active')
+      @scrollToTab(tabView)
 
   getActiveTab: ->
     @tabForItem(@pane.getActiveItem())

      @insertBefore(tab, followingTab)
    else
      @appendChild(tab)
    tab.updateTitle()
    @updateTabBarVisibility()


    tab.updateTitle() for tab in @getTabs()
    @updateTabBarVisibility()

  scrollToTab: (tab) ->
    tabRightEdge = tab.offsetLeft + tab.offsetWidth
    tabBarRightEdge = this.scrollLeft + this.offsetWidth

    if tabRightEdge > tabBarRightEdge
      this.scrollLeft = tabRightEdge - this.offsetWidth
    else if this.scrollLeft > tab.offsetLeft
      this.scrollLeft = tab.offsetLeft

  updateTabBarVisibility: ->
    if not atom.config.get('tabs.alwaysShowTabBar') and not @shouldAllowDrag()
      @classList.add('hidden')
