Skip to content

Commit 7df65c9

Browse files
committed
Fix inTabOrder menu action, change default, and factor out code for setting/unsetting the tab index (in case the page author wants to call it.
1 parent a1bfe0a commit 7df65c9

File tree

2 files changed

+27
-18
lines changed

2 files changed

+27
-18
lines changed

unpacked/MathJax.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1896,7 +1896,7 @@ MathJax.Hub = {
18961896
mpContext: false, // true means pass menu events to MathPlayer in IE
18971897
mpMouse: false, // true means pass mouse events to MathPlayer in IE
18981898
texHints: true, // include class names for TeXAtom elements
1899-
inTabOrder: false, // set to false if math elements should be included in the tabindex
1899+
inTabOrder: true, // set to false if math elements should be included in the tabindex
19001900
semantics: false // add semantics tag with original form in MathML output
19011901
},
19021902

unpacked/extensions/MathMenu.js

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -544,26 +544,12 @@
544544
MENU.FocusNode(menu);
545545
},
546546
Activate: function(event, menu) {
547-
var jaxs = MENU.AllNodes();
548-
for (var j = 0, jax; jax = jaxs[j]; j++) {
549-
if (jax.tabIndex > 0) {
550-
jax.oldTabIndex = jax.tabIndex;
551-
}
552-
jax.tabIndex = -1;
553-
}
547+
MENU.UnsetTabIndex();
554548
MENU.posted = true;
555549
},
556550
Unfocus: function() {
557551
MENU.ActiveNode().tabIndex = -1;
558-
var jaxs = MENU.AllNodes();
559-
for (var j = 0, jax; jax = jaxs[j]; j++) {
560-
if (jax.oldTabIndex !== undefined) {
561-
jax.tabIndex = jax.oldTabIndex
562-
delete jax.oldTabIndex;
563-
} else {
564-
jax.tabIndex = HUB.getTabOrder();
565-
}
566-
}
552+
MENU.SetTabIndex();
567553
MENU.FocusNode(MENU.CurrentNode());
568554
MENU.posted = false;
569555
},
@@ -585,6 +571,26 @@
585571
Left: function(event, menu) {
586572
MENU.MoveHorizontal(event, menu, function(x) {return x - 1;});
587573
},
574+
UnsetTabIndex: function () {
575+
var jaxs = MENU.AllNodes();
576+
for (var j = 0, jax; jax = jaxs[j]; j++) {
577+
if (jax.tabIndex > 0) {
578+
jax.oldTabIndex = jax.tabIndex;
579+
}
580+
jax.tabIndex = -1;
581+
}
582+
},
583+
SetTabIndex: function () {
584+
var jaxs = MENU.AllNodes();
585+
for (var j = 0, jax; jax = jaxs[j]; j++) {
586+
if (jax.oldTabIndex !== undefined) {
587+
jax.tabIndex = jax.oldTabIndex
588+
delete jax.oldTabIndex;
589+
} else {
590+
jax.tabIndex = HUB.getTabOrder();
591+
}
592+
}
593+
},
588594

589595
//TODO: Move to utility class.
590596
// Computes a mod n.
@@ -1336,6 +1342,9 @@
13361342
}
13371343
};
13381344

1345+
/*
1346+
* Toggle assistive MML settings
1347+
*/
13391348
MENU.AssistiveMML = function (item,restart) {
13401349
var AMML = MathJax.Extension.AssistiveMML;
13411350
if (!AMML) {
@@ -1543,7 +1552,7 @@
15431552
ITEM.RULE(),
15441553
ITEM.CHECKBOX("Fast Preview", "FastPreview"),
15451554
ITEM.CHECKBOX("Assistive MathML", "assistiveMML", {action:MENU.AssistiveMML}),
1546-
ITEM.CHECKBOX("Include in Tab Order", "inTabOrder", {action:CONFIG.inTabOrder})
1555+
ITEM.CHECKBOX("Include in Tab Order", "inTabOrder")
15471556
),
15481557
ITEM.SUBMENU("MathPlayer", {hidden:!HUB.Browser.isMSIE || !CONFIG.showMathPlayer,
15491558
disabled:!HUB.Browser.hasMathPlayer},

0 commit comments

Comments
 (0)