Initial "click" handling for dropdown tabs

Still uncomplete, there are a number of edge cases that need to be
handled. Keyboard navigation is one of them, hover/click distinction
is another one.

refs #6167
This commit is contained in:
Thomas Gelf 2014-05-09 11:49:15 +00:00
parent 23679c0078
commit 19220a5a44
1 changed files with 7 additions and 1 deletions

View File

@ -114,6 +114,7 @@
$(document).on('mouseleave', '.historycolorgrid td', this.historycolorgidUnhover);
$(document).on('mouseenter', 'li.dropdown', this.dropdownHover);
$(document).on('mouseleave', 'li.dropdown', this.dropdownLeave);
$(document).on('mouseenter', '#menu > ul > li', this.menuTitleHovered);
$(document).on('mouseleave', '#sidebar', this.leaveSidebar);
$(document).on('click', '.tree .handle', { self: this }, this.treeNodeToggle);
@ -189,7 +190,7 @@
dropdownLeave: function () {
var $li = $(this);
setTimeout(function () {
if (! $li.is('li:hover')) {
if (! $li.is('li:hover') && ! $li.find(':focus')) {
$li.removeClass('hover');
}
}, 300);
@ -453,6 +454,11 @@
}
}
if (href === '#') {
// Allow to access dropdown menu by keyboard
if ($a.hasClass('dropdown-toggle')) {
$a.closest('li').toggleClass('hover');
}
// Ignore link, no action
return false;
}