                 =>return null)
               window.location.reload() )},
             {id : "cancel-button", label : "Cancel", callback : ( => @reloadDenied = true ) } ] )
+
+    $("a[href=#tab-comments]").on "shown", (event) =>
+      @updateActiveComment()
+    $("a[href=#tab-trees]").on "shown", (event) =>
+      @updateActiveTree()
 
     @updateComments()
     @updateTrees()


      # animate scrolling to the new tree
      $("#tree-list").animate({
        scrollTop: newIcon.offset().top - $("#tree-list").offset().top + $("#tree-list").scrollTop()}, 500)


  # avoid lags caused by frequent DOM modification

      if treeId != lastTreeId
        newContent.appendChild((
          $('<li>').append($('<i>', {"class": "icon-sitemap"}),
          $('<span>', {"data-treeid": treeId, "text": @model.route.getTree(treeId).name})))[0])
        lastTreeId = treeId
      newContent.appendChild((
        $('<li>').append($('<i>', {"class": "icon-angle-right"}), 
