Caches focused node.
This commit is contained in:
parent
fbb70fb658
commit
f73d5f0094
|
@ -478,6 +478,7 @@
|
||||||
* Keyboard navigation of menu.
|
* Keyboard navigation of menu.
|
||||||
*/
|
*/
|
||||||
posted: false, // Is a menu open?
|
posted: false, // Is a menu open?
|
||||||
|
active: null, // The focused in HTML node in the menu.
|
||||||
|
|
||||||
GetNode: function(jax) {
|
GetNode: function(jax) {
|
||||||
var node = document.getElementById(jax.inputID + '-Frame');
|
var node = document.getElementById(jax.inputID + '-Frame');
|
||||||
|
@ -495,7 +496,11 @@
|
||||||
return nodes;
|
return nodes;
|
||||||
},
|
},
|
||||||
ActiveNode: function() {
|
ActiveNode: function() {
|
||||||
return document.activeElement;
|
return MENU.active;
|
||||||
|
},
|
||||||
|
FocusNode: function(node) {
|
||||||
|
MENU.active = node;
|
||||||
|
node.focus();
|
||||||
},
|
},
|
||||||
//
|
//
|
||||||
// Focus is a global affair, since we only ever want a single focused item.
|
// Focus is a global affair, since we only ever want a single focused item.
|
||||||
|
@ -503,7 +508,7 @@
|
||||||
Focus: function(menu) {
|
Focus: function(menu) {
|
||||||
!MENU.posted ? MENU.Activate(menu) : MENU.ActiveNode().tabIndex = -1;
|
!MENU.posted ? MENU.Activate(menu) : MENU.ActiveNode().tabIndex = -1;
|
||||||
menu.tabIndex = 0;
|
menu.tabIndex = 0;
|
||||||
menu.focus();
|
MENU.FocusNode(menu);
|
||||||
},
|
},
|
||||||
Activate: function(event, menu) {
|
Activate: function(event, menu) {
|
||||||
var jaxs = MENU.AllNodes();
|
var jaxs = MENU.AllNodes();
|
||||||
|
@ -518,7 +523,7 @@
|
||||||
for (var j = 0, jax; jax = jaxs[j]; j++) {
|
for (var j = 0, jax; jax = jaxs[j]; j++) {
|
||||||
jax.tabIndex = 0;
|
jax.tabIndex = 0;
|
||||||
}
|
}
|
||||||
MENU.CurrentNode().focus();
|
MENU.FocusNode(MENU.CurrentNode());
|
||||||
MENU.posted = false;
|
MENU.posted = false;
|
||||||
},
|
},
|
||||||
MoveHorizontal: function(event, menu, move) {
|
MoveHorizontal: function(event, menu, move) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user