I'm using the latest jQueryUI Menu code, but when I tab into the menu, and select a link by hitting the Enter key, the li containing a suitable a href does not open. The only way to get a link to open is to click with the mouse, but I want the Enter key to function for accessibility. Here's the code I'm using:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Menu - Navigation Menu</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.0/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script src="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function() {
$( "#menu" ).menu({
select: function( event, ui ) {
var link = ui.item.children( "a:first" );
if ( link.attr( "target" ) || event.metaKey || event.shiftKey || event.ctrlKey ) {
return;
}
location.href = link.attr( "href" );
}
});
});
</script>
</head>
<body>
<ul id="menu">
<li><a href="http://www.yahoo.com" target="_blank">Yahoo</a></li>
<li>
<a href="http://www.bing.com" target="_blank">Bing</a>
<ul>
<li><a href="http://www.google.com" target="_blank">Google</a>
<ul>
<li><a href="http://www.lycos.com" target="_blank">Lycos</a></li>
</ul>
</li>
<li><a href="?Saarland">Saarland</a></li>
<li><a href="?Salzburg">Salzburg</a></li>
</ul>
</li>
</ul>
</body>
</html>
Here is a live version: http://kavelookout.com/menuTest_jQueryUI_Menu/ The 'Search Engine' texts in the list have hyperlinks.
Perhaps I need to edit the jquery-ui.js file? I have searched high and low, but cannot find a suitable answer.
Many thanks for any kind help,
R