Commit 4be48722 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge "Bug #1692757: Collapse main menu by pressing Esc key"

parents 19a68352 4e0251a6
......@@ -257,5 +257,18 @@ jQuery(function($) {
$(".js-select2 select").select2({});
/*
* Close navigation when ESC is pressed or focus is moved from navigation menu
*/
$(document).on('click keyup', function(event) {
// keyESCAPE constant is used since jQuerty.ui is not loaded on all pages
var keyESCAPE = 27;
if (
(event.type=='click' && !$(event.target).closest('.navbar-toggle').length) ||
(event.type == 'keyup' && event.keyCode == keyESCAPE)
) {
$('.navbar-collapse.collapse.in').collapse('hide');
}
});
});
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