Menu: Make keyboard focus matching take submenus into account

This commit is contained in:
jzaefferer 2011-04-20 15:35:40 +02:00
parent 5076f233db
commit f0d5a0008f

View File

@ -132,13 +132,13 @@ $.widget("ui.menu", {
function escape(value) {
return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
}
var match = self.widget().children(".ui-menu-item").filter(function() {
var match = self.activeMenu.children(".ui-menu-item").filter(function() {
return new RegExp("^" + escape(character), "i").test($(this).children("a").text());
});
var match = skip && match.index(self.active.next()) != -1 ? self.active.nextAll(".ui-menu-item") : match;
if (!match.length) {
character = String.fromCharCode(event.keyCode);
match = self.widget().children(".ui-menu-item").filter(function() {
match = self.activeMenu.children(".ui-menu-item").filter(function() {
return new RegExp("^" + escape(character), "i").test($(this).children("a").text());
});
}