Navigation of RTL menus.
This commit is contained in:
parent
66b56d9ac9
commit
9654bd4256
|
@ -522,9 +522,7 @@
|
||||||
MENU.CurrentNode().focus();
|
MENU.CurrentNode().focus();
|
||||||
MENU.posted = false;
|
MENU.posted = false;
|
||||||
},
|
},
|
||||||
//TODO: A toggle focus method on the top level would avoid having to
|
MoveHorizontal: function(event, menu, move) {
|
||||||
//tabIndex all the Jaxs.
|
|
||||||
Move: function(event, menu, move) {
|
|
||||||
var jaxs = MENU.AllNodes();
|
var jaxs = MENU.AllNodes();
|
||||||
var len = jaxs.length;
|
var len = jaxs.length;
|
||||||
if (len === 0) {
|
if (len === 0) {
|
||||||
|
@ -539,10 +537,10 @@
|
||||||
MENU.menu.Post(null);
|
MENU.menu.Post(null);
|
||||||
},
|
},
|
||||||
Right: function(event, menu) {
|
Right: function(event, menu) {
|
||||||
MENU.Move(event, menu, function(x) {return x + 1;});
|
MENU.MoveHorizontal(event, menu, function(x) {return x + 1;});
|
||||||
},
|
},
|
||||||
Left: function(event, menu) {
|
Left: function(event, menu) {
|
||||||
MENU.Move(event, menu, function(x) {return x - 1;});
|
MENU.MoveHorizontal(event, menu, function(x) {return x - 1;});
|
||||||
},
|
},
|
||||||
|
|
||||||
//TODO: Move to utility class.
|
//TODO: Move to utility class.
|
||||||
|
@ -670,7 +668,7 @@
|
||||||
}
|
}
|
||||||
return def;
|
return def;
|
||||||
},
|
},
|
||||||
Move: function(event, item, move) {
|
MoveVertical: function(event, item, move) {
|
||||||
var menuNode = ITEM.GetMenuNode(item);
|
var menuNode = ITEM.GetMenuNode(item);
|
||||||
var items = [];
|
var items = [];
|
||||||
for (var i = 0, allItems = menuNode.menuItem.items, it;
|
for (var i = 0, allItems = menuNode.menuItem.items, it;
|
||||||
|
@ -692,20 +690,22 @@
|
||||||
items[index].Activate(event, children[index]);
|
items[index].Activate(event, children[index]);
|
||||||
},
|
},
|
||||||
Up: function(event, item) {
|
Up: function(event, item) {
|
||||||
this.Move(event, item, function(x) { return x - 1; });
|
this.MoveVertical(event, item, function(x) { return x - 1; });
|
||||||
},
|
},
|
||||||
Down: function(event, item) {
|
Down: function(event, item) {
|
||||||
this.Move(event, item, function(x) { return x + 1; });
|
this.MoveVertical(event, item, function(x) { return x + 1; });
|
||||||
},
|
},
|
||||||
Right: function(event, item) {
|
Right: function(event, item) {
|
||||||
if (ITEM.GetMenuNode(item).menuItem === MENU.menu) {
|
this.MoveHorizontal(event, item, MENU.Right, !this.isRTL());
|
||||||
MENU.Right(event, item);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
Left: function(event, item) {
|
Left: function(event, item) {
|
||||||
|
this.MoveHorizontal(event, item, MENU.Left, this.isRTL());
|
||||||
|
},
|
||||||
|
MoveHorizontal: function(event, item, move, rtl) {
|
||||||
if (ITEM.GetMenuNode(item).menuItem === MENU.menu) {
|
if (ITEM.GetMenuNode(item).menuItem === MENU.menu) {
|
||||||
MENU.Left(event, item);
|
move(event, item);
|
||||||
} else {
|
}
|
||||||
|
if (rtl) { return; }
|
||||||
this.Deactivate(item);
|
this.Deactivate(item);
|
||||||
var sibling = item.parentNode.previousSibling;
|
var sibling = item.parentNode.previousSibling;
|
||||||
var actives = sibling.getElementsByClassName('MathJax_MenuActive');
|
var actives = sibling.getElementsByClassName('MathJax_MenuActive');
|
||||||
|
@ -713,7 +713,6 @@
|
||||||
MENU.Focus(actives[0]);
|
MENU.Focus(actives[0]);
|
||||||
}
|
}
|
||||||
this.RemoveSubmenus(item);
|
this.RemoveSubmenus(item);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
Space: function (event, menu) {
|
Space: function (event, menu) {
|
||||||
this.Mouseup(event, menu);
|
this.Mouseup(event, menu);
|
||||||
|
@ -829,10 +828,15 @@
|
||||||
}
|
}
|
||||||
MENU.Focus(menu);
|
MENU.Focus(menu);
|
||||||
},
|
},
|
||||||
Right: function(event, menu) {
|
MoveHorizontal: function(event, menu, move, rtl) {
|
||||||
|
console.log(move);
|
||||||
if (this.disabled) {
|
if (this.disabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!rtl) {
|
||||||
|
this.SUPER(arguments).MoveHorizontal.apply(this, arguments);
|
||||||
|
return;
|
||||||
|
}
|
||||||
var submenuNodes = ITEM.GetMenuNode(menu).nextSibling.childNodes;
|
var submenuNodes = ITEM.GetMenuNode(menu).nextSibling.childNodes;
|
||||||
if (submenuNodes.length > 0) {
|
if (submenuNodes.length > 0) {
|
||||||
this.submenu.items[0].Activate(event, submenuNodes[0]);
|
this.submenu.items[0].Activate(event, submenuNodes[0]);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user