diff --git a/core/modules/toolbar/templates/toolbar.html.twig b/core/modules/toolbar/templates/toolbar.html.twig
index 4572b9d..1e4cff1 100644
--- a/core/modules/toolbar/templates/toolbar.html.twig
+++ b/core/modules/toolbar/templates/toolbar.html.twig
@@ -22,11 +22,11 @@
  * @ingroup themeable
  */
 #}
-<div{{ attributes }}>
-  <nav{{ toolbar_attributes }}>
+<div{{ attributes.addClass('toolbar') }}>
+  <nav{{ toolbar_attributes.addClass( [ 'toolbar-bar', 'clearfix' ] ) }}>
     <h2 class="visually-hidden">{{ toolbar_heading }}</h2>
     {% for tab in tabs %}
-      <div{{ tab.attributes }}>{{ tab.link }}</div>
+      <div{{ tab.attributes.addClass('toolbar-tab') }}>{{ tab.link }}</div>
     {% endfor %}
   </nav>
   {% for tray in trays %}
diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module
index 788378c..49e2530 100644
--- a/core/modules/toolbar/toolbar.module
+++ b/core/modules/toolbar/toolbar.module
@@ -78,7 +78,6 @@ function toolbar_element_info() {
       // The id cannot be simply "toolbar" or it will clash with the simpletest
       // tests listing which produces a checkbox with attribute id="toolbar"
       'id' => 'toolbar-administration',
-      'class' => array('toolbar'),
       'role' => 'group',
       'aria-label' => t('Site administration toolbar'),
     ),
@@ -87,7 +86,6 @@ function toolbar_element_info() {
       '#heading' => t('Toolbar items'),
       '#attributes' => array(
         'id' => 'toolbar-bar',
-        'class' => array('toolbar-bar', 'clearfix',),
         'role' => 'navigation',
         'aria-label' => t('Toolbar items'),
       ),
@@ -243,14 +241,11 @@ function template_preprocess_toolbar(&$variables) {
       }
     }
 
+    $attributes = array();
     // Pass the wrapper attributes along.
     if (array_key_exists('#wrapper_attributes', $element[$key])) {
-      $element[$key]['#wrapper_attributes']['class'][] = 'toolbar-tab';
       $attributes = $element[$key]['#wrapper_attributes'];
     }
-    else {
-      $attributes = array('class' => array('toolbar-tab'));
-    }
 
     // Add the tab.
     $variables['tabs'][$key] = array(
