Fix dropdown losing focus when navigating w/ the keyboard

This commit is contained in:
Eric Lippmann 2016-01-12 08:24:08 +01:00
parent 672e8359e4
commit 66c4b9a3da
1 changed files with 6 additions and 3 deletions

View File

@ -32,9 +32,12 @@
*/
function clearFocus(e) {
var $dropdown = $(this);
if ($(e.target).is($dropdown.find('a').last())) {
$dropdown.removeClass('active');
}
// Timeout is required to wait for the next element in the DOM to receive focus
setTimeout(function() {
if (! $.contains($dropdown[0], document.activeElement)) {
$dropdown.removeClass('active');
}
}, 10);
}
Icinga.Behaviors = Icinga.Behaviors || {};