I\'m stuck on figuring out the logic to make a drop down menu keyboard accessible.
The HTML is structured as such (extra class names used for clarity):
You can use event bubbling to check what has focus on the focusin event. I had success with the following code:
$("li:has(ul.popUpMenu)").focusin(function(e) {
$(this).children().fadeIn('slow');
});
$('body').focusin(function(e) {
if (!$(e.target).parent().is('ul.popUpMenu li')) {
$('ul.popUpMenu').fadeOut('slow');
}
});
You could(should) probably make it more optimized, but it works.