Fixes issues with submenus.

This commit is contained in:
zorkow 2015-08-21 04:59:31 +01:00
parent 1be417af3a
commit 85c1801fba

View File

@ -595,8 +595,7 @@
this.Activate(menu); this.Activate(menu);
}, },
Mouseout: function (event,menu) { Mouseout: function (event,menu) {
if (!this.submenu || !this.submenu.posted) {this.Deactivate(menu)} this.Deactivate(menu);
if (this.timer) {clearTimeout(this.timer); delete this.timer}
}, },
Mouseup: function (event,menu) {return this.Remove(event,menu)}, Mouseup: function (event,menu) {return this.Remove(event,menu)},
@ -793,23 +792,34 @@
},[this.isRTL() ? this.markerRTL : this.marker]]]; },[this.isRTL() ? this.markerRTL : this.marker]]];
}, },
Timer: function (event,menu) { Timer: function (event,menu) {
if (this.timer) {clearTimeout(this.timer)} this.ClearTimer();
event = {clientX: event.clientX, clientY: event.clientY}; // MSIE can't pass the event below event = {clientX: event.clientX, clientY: event.clientY}; // MSIE can't pass the event below
this.timer = setTimeout(CALLBACK(["Mouseup",this,event,menu]),CONFIG.delay); this.timer = setTimeout(CALLBACK(["Mouseup",this,event,menu]),CONFIG.delay);
}, },
ClearTimer: function() {
if (this.timer) {
clearTimeout(this.timer);
}
},
Touchend: function (event,menu) { Touchend: function (event,menu) {
var forceout = this.submenu.posted; var forceout = this.submenu.posted;
var result = this.SUPER(arguments).Touchend.apply(this,arguments); var result = this.SUPER(arguments).Touchend.apply(this,arguments);
if (forceout) {this.Deactivate(menu); delete ITEM.lastItem; delete ITEM.lastMenu} if (forceout) {this.Deactivate(menu); delete ITEM.lastItem; delete ITEM.lastMenu}
return result; return result;
}, },
Mouseout: function(event, menu) {
if (!this.submenu.posted) {
this.Deactivate(menu);
}
this.ClearTimer();
},
Mouseover: function(event, menu) { Mouseover: function(event, menu) {
this.Activate(menu); this.Activate(menu);
}, },
Mouseup: function (event,menu) { Mouseup: function (event,menu) {
if (!this.disabled) { if (!this.disabled) {
if (!this.submenu.posted) { if (!this.submenu.posted) {
if (this.timer) {clearTimeout(this.timer); delete this.timer} this.ClearTimer();
this.submenu.Post(event,menu,this.ltr); this.submenu.Post(event,menu,this.ltr);
MENU.Focus(menu); MENU.Focus(menu);
} else { } else {
@ -825,11 +835,11 @@
} }
if (!this.submenu.posted) { if (!this.submenu.posted) {
this.DeactivateSubmenus(menu); this.DeactivateSubmenus(menu);
}
MENU.Focus(menu);
if (!MENU.isMobile) { if (!MENU.isMobile) {
this.Timer(event,menu); this.Timer(event,menu);
} }
}
MENU.Focus(menu);
}, },
Right: function(event, menu) { Right: function(event, menu) {
if (this.submenu.items.length > 0) { if (this.submenu.items.length > 0) {
@ -911,7 +921,6 @@
/*************************************************************/ /*************************************************************/
/* /*
* A menu item that is a label * A menu item that is a label
* //TODO: Turn this into a focusable! No mouse interaction!
*/ */
MENU.ITEM.LABEL = MENU.ENTRY.Subclass({ MENU.ITEM.LABEL = MENU.ENTRY.Subclass({
role: "menuitem", // Aria role. role: "menuitem", // Aria role.
@ -927,7 +936,8 @@
Activate: function(menu) { Activate: function(menu) {
this.Deactivate(menu); this.Deactivate(menu);
MENU.Focus(menu); MENU.Focus(menu);
} },
Mouseup: function (event,menu) { }
}); });
/*************************************************************/ /*************************************************************/