$.widget("ui.menu", {
defaultElement: "<ul>",
+ delay: 150,
options: {
position: {
my: "left top",
// need to remove the attribute before adding it for the screenreader to pick up the change
// see http://groups.google.com/group/jquery-a11y/msg/929e0c1e8c5efc8f
this.element.removeAttr("aria-activedescendant").attr("aria-activedescendant", self.itemId)
-
- self._close();
+
+ self.timer = setTimeout(function() {
+ self._close();
+ }, self.delay)
var nested = $(">ul", item);
if (nested.length && /^mouse/.test(event.type)) {
- self._open(nested);
+ self._startOpening(nested);
}
this.activeMenu = item.parent();
return;
}
+ clearTimeout(this.timer);
+
this.active.children( "a" ).removeClass( "ui-state-focus" );
// remove only generated id
$( "#" + this.menuId + "-activedescendant" ).removeAttr( "id" );
this.active = null;
},
+ _startOpening: function(submenu) {
+ clearTimeout(this.timer);
+ var self = this;
+ self.timer = setTimeout(function() {
+ self._close();
+ self._open(submenu);
+ }, self.delay);
+ },
+
_open: function(submenu) {
this.element.find(".ui-menu").not(submenu.parents()).hide();
-
+
var position = $.extend({}, {
of: this.active
}, $.type(this.options.position) == "function"