diff --git a/core/modules/toolbar/js/views/ToolbarVisualView.js b/core/modules/toolbar/js/views/ToolbarVisualView.js
index be2264b..43f059f 100644
--- a/core/modules/toolbar/js/views/ToolbarVisualView.js
+++ b/core/modules/toolbar/js/views/ToolbarVisualView.js
@@ -77,10 +77,11 @@ Drupal.toolbar.ToolbarVisualView = Backbone.View.extend({
     // If this tab has a tray associated with it, it is considered an
     // activatable tab.
     if (event.target.hasAttribute('data-toolbar-tray')) {
-      var tab = this.model.get('activeTab');
-      var id = '#' + event.target.id;
+      var activeTab = this.model.get('activeTab');
+      var clickedTab = document.getElementById(event.target.id);
+
       // Set the event target as the active item if it is not already.
-      this.model.set('activeTab', (!tab || id !== tab) ? id : null);
+      this.model.set('activeTab', (!activeTab || clickedTab !== activeTab) ? clickedTab : null);
 
       event.preventDefault();
       event.stopPropagation();
