Commit 7c37dac7 authored by alexpott's avatar alexpott

Issue #2103247 by Tom Verhaeghe | stpaultim: Fixed Clicking menu links in the...

Issue #2103247 by Tom Verhaeghe | stpaultim: Fixed Clicking menu links in the administration menu tray should close the admin menu tray, while in a narrow viewport where the toolbar is positioned on top of the content.
parent 547a1a0d
......@@ -37,6 +37,23 @@
toggleList($openItems, false);
}
/**
* Handle clicks from a menu item link.
*
* @param {Object} event
* A jQuery Event object.
*/
function linkClickHandler(event) {
// If the toolbar is positioned fixed (and therefore hiding content
// underneath), then users expect clicks in the administration menu tray
// to take them to that destination but for the menu tray to be closed
// after clicking: otherwise the toolbar itself is obstructing the view
// of the destination they chose.
if (!Drupal.toolbar.models.toolbarModel.get('isFixed')) {
Drupal.toolbar.models.toolbarModel.set('activeTab', null);
}
}
/**
* Toggle the open/close state of a list is a menu.
*
......@@ -136,7 +153,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');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment