Commit 4b75fcb7 authored by Doris Tam's avatar Doris Tam
Browse files

Bug 1903933: Change the condition for collapsing from on blur to on keyup

This is so we are still able to expand the last submenu without it collapsing
by clicking on the arrow (last menu item) rather than collapsing the menu
when removing focus from it (what was the last menu item before expanding it).

Change-Id: Ie8920b1731b41e3db5f943d50f43642608885dc2
parent 7ce0fe80
...@@ -1206,11 +1206,12 @@ jQuery(function($) { ...@@ -1206,11 +1206,12 @@ jQuery(function($) {
}); });
}); });
// Returns focus back to the menu button when the menu is closed // Return focus to the menu button on pressing esc on nav
$('nav .navbar-collapse').on('hide.bs.collapse', function(e) { $('nav .navbar-collapse').on('keyup', function(e) {
if (!$(e.target).hasClass('child-nav collapse show')) { if (e.keyCode == 27) {
var id = $(this).attr('id'); var parent = $(this);
$('button[aria-controls=' + id + ']').focus(); var id = $(parent).attr('id');
$('button[aria-controls="' + id + '"]').focus();
} }
}); });
}); });
......
Supports Markdown
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