diff --git a/core/modules/toolbar/js/toolbar.menu.js b/core/modules/toolbar/js/toolbar.menu.js index 1cfe3ea..0892a5e 100644 --- a/core/modules/toolbar/js/toolbar.menu.js +++ b/core/modules/toolbar/js/toolbar.menu.js @@ -38,6 +38,19 @@ } /** + * Handle clicks from any toolbar-box link to decide whether to hide or show the menu. + * + * @param {Object} event + * A jQuery Event object. + */ + function linkClickHandler(event) { + // If the menu is fixed and blocking anything on the page, then don't set disable the active tab after clicking. + if (!Drupal.toolbar.models.toolbarModel.attributes.isFixed) { + Drupal.toolbar.models.toolbarModel.set('activeTab', null); + } + } + + /** * Toggle the open/close state of a list is a menu. * * @param {jQuery} $item @@ -136,7 +149,9 @@ // Bind event handlers. $(document) - .on('click.toolbar', '.toolbar-handle', toggleClickHandler); + .on('click.toolbar', '.toolbar-handle', toggleClickHandler) + .on('click.toolbar', '.toolbar-box a', linkClickHandler); + // Return the jQuery object. return this.each(function (selector) { var $menu = $(this).once('toolbar-menu');