diff --git a/core/modules/toolbar/js/toolbar.js b/core/modules/toolbar/js/toolbar.js
index 9a19205..4734890 100644
--- a/core/modules/toolbar/js/toolbar.js
+++ b/core/modules/toolbar/js/toolbar.js
@@ -122,20 +122,27 @@
           .on('change:orientation', function (model, orientation) {
             $(document).trigger('drupalToolbarOrientationChange', orientation);
           })
           .on('change:activeTab', function (model, tab) {
             $(document).trigger('drupalToolbarTabChange', tab);
           })
           .on('change:activeTray', function (model, tray) {
             $(document).trigger('drupalToolbarTrayChange', tray);
           });
 
+        // Trigger window resize event when toolbar is processed and
+        // when the toolbar tray is shown or hidden.
+        $(window).trigger('resize');
+        model.on('change:activeTray', function (model, tray) {
+          $(window).trigger('resize');
+        });
+
         // If the toolbar's orientation is horizontal and no active tab is
         // defined then show the tray of the first toolbar tab by default (but
         // not the first 'Home' toolbar tab).
         if (Drupal.toolbar.models.toolbarModel.get('orientation') === 'horizontal' && Drupal.toolbar.models.toolbarModel.get('activeTab') === null) {
           Drupal.toolbar.models.toolbarModel.set({
             activeTab: $('.toolbar-bar .toolbar-tab:not(.home-toolbar-tab) a').get(0)
           });
         }
       });
     }
