diff --git a/core/modules/toolbar/js/toolbar.es6.js b/core/modules/toolbar/js/toolbar.es6.js index f715fc7fc9..f22838e22f 100644 --- a/core/modules/toolbar/js/toolbar.es6.js +++ b/core/modules/toolbar/js/toolbar.es6.js @@ -141,9 +141,13 @@ // 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), - }); + const firstItem = $('.toolbar-bar .toolbar-tab:not(.home-toolbar-tab) a'); + const attr = firstItem.attr('data-toolbar-tray'); + if (typeof attr !== typeof undefined && attr !== false) { + Drupal.toolbar.models.toolbarModel.set({ + activeTab: firstItem.get(0), + }); + } } }); }, diff --git a/core/modules/toolbar/js/toolbar.js b/core/modules/toolbar/js/toolbar.js index 547bcd9bac..f7bbfb4325 100644 --- a/core/modules/toolbar/js/toolbar.js +++ b/core/modules/toolbar/js/toolbar.js @@ -4,6 +4,7 @@ * https://www.drupal.org/node/2815083 * @preserve **/ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; (function ($, Drupal, drupalSettings) { var options = $.extend({ @@ -95,9 +96,13 @@ }); 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) - }); + var firstItem = $('.toolbar-bar .toolbar-tab:not(.home-toolbar-tab) a'); + var attr = firstItem.attr('data-toolbar-tray'); + if ((typeof attr === 'undefined' ? 'undefined' : _typeof(attr)) !== (typeof undefined === 'undefined' ? 'undefined' : _typeof(undefined)) && attr !== false) { + Drupal.toolbar.models.toolbarModel.set({ + activeTab: firstItem.get(0) + }); + } } }); }