Proper keyhandling for popup windows.
This commit is contained in:
parent
6cc308b5d0
commit
afdd671999
|
@ -101,7 +101,7 @@
|
||||||
HELP.Post = function () {
|
HELP.Post = function () {
|
||||||
this.div = MENU.Background(this);
|
this.div = MENU.Background(this);
|
||||||
var help = HTML.addElement(this.div,"div",{
|
var help = HTML.addElement(this.div,"div",{
|
||||||
id: "MathJax_Help", tabIndex: "0"
|
id: "MathJax_Help", tabIndex: 0, onkeydown: HELP.Keydown
|
||||||
},LOCALE._("HelpDialog",[
|
},LOCALE._("HelpDialog",[
|
||||||
["b",{style:{fontSize:"120%"}},[["Help","MathJax Help"]]],
|
["b",{style:{fontSize:"120%"}},[["Help","MathJax Help"]]],
|
||||||
["div",{id: "MathJax_HelpContent"},[
|
["div",{id: "MathJax_HelpContent"},[
|
||||||
|
@ -149,7 +149,7 @@
|
||||||
]],
|
]],
|
||||||
["a",{href:"http://www.mathjax.org/"},["www.mathjax.org"]],
|
["a",{href:"http://www.mathjax.org/"},["www.mathjax.org"]],
|
||||||
["span",{id: "MathJax_HelpClose", onclick: HELP.Remove,
|
["span",{id: "MathJax_HelpClose", onclick: HELP.Remove,
|
||||||
onkeydown: HELP.Remove, tabIndex: '0',
|
onkeydown: HELP.Keydown, tabIndex: 0,
|
||||||
'aria-label': 'Close', 'aria-describedby': 'Close window'},
|
'aria-label': 'Close', 'aria-describedby': 'Close window'},
|
||||||
[["span",{},["\u00D7"]]]
|
[["span",{},["\u00D7"]]]
|
||||||
]
|
]
|
||||||
|
@ -170,6 +170,13 @@
|
||||||
HELP.Remove = function (event) {
|
HELP.Remove = function (event) {
|
||||||
if (HELP.div) {document.body.removeChild(HELP.div); delete HELP.div}
|
if (HELP.div) {document.body.removeChild(HELP.div); delete HELP.div}
|
||||||
};
|
};
|
||||||
|
HELP.Keydown = function(event) {
|
||||||
|
if (event.keyCode === KEY.ESCAPE ||
|
||||||
|
(this.id === 'MathJax_HelpClose' &&
|
||||||
|
(event.keyCode === KEY.SPACE || event.keyCode === KEY.Return))) {
|
||||||
|
HELP.Remove(event);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
MathJax.Callback.Queue(
|
MathJax.Callback.Queue(
|
||||||
HUB.Register.StartupHook("End Config",{}), // wait until config is complete
|
HUB.Register.StartupHook("End Config",{}), // wait until config is complete
|
||||||
|
|
|
@ -1018,7 +1018,7 @@
|
||||||
]]);
|
]]);
|
||||||
MENU.About.div = MENU.Background(MENU.About);
|
MENU.About.div = MENU.Background(MENU.About);
|
||||||
var about = HTML.addElement(MENU.About.div,"div",{
|
var about = HTML.addElement(MENU.About.div,"div",{
|
||||||
id: "MathJax_About", tabIndex:0
|
id: "MathJax_About", tabIndex: 0, onkeydown: MENU.About.Keydown
|
||||||
},[
|
},[
|
||||||
["b",{style:{fontSize:"120%"}},["MathJax"]]," v"+MathJax.version,["br"],
|
["b",{style:{fontSize:"120%"}},["MathJax"]]," v"+MathJax.version,["br"],
|
||||||
_(font.replace(/ /g,""),"using "+font),["br"],["br"],
|
_(font.replace(/ /g,""),"using "+font),["br"],["br"],
|
||||||
|
@ -1030,7 +1030,7 @@
|
||||||
["a",{href:"http://www.mathjax.org/"},["www.mathjax.org"]],
|
["a",{href:"http://www.mathjax.org/"},["www.mathjax.org"]],
|
||||||
["span",{className:"MathJax_MenuClose",id:"MathJax_AboutClose",
|
["span",{className:"MathJax_MenuClose",id:"MathJax_AboutClose",
|
||||||
onclick:MENU.About.Remove,
|
onclick:MENU.About.Remove,
|
||||||
onkeydown:MENU.About.Remove, tabIndex:0,
|
onkeydown: MENU.About.Keydown, tabIndex: 0,
|
||||||
'aria-label': "Close", 'aria-describedby': "Close window"},
|
'aria-label': "Close", 'aria-describedby': "Close window"},
|
||||||
[["span",{},"\u00D7"]]]
|
[["span",{},"\u00D7"]]]
|
||||||
]);
|
]);
|
||||||
|
@ -1050,6 +1050,13 @@
|
||||||
MENU.About.Remove = function (event) {
|
MENU.About.Remove = function (event) {
|
||||||
if (MENU.About.div) {document.body.removeChild(MENU.About.div); delete MENU.About.div}
|
if (MENU.About.div) {document.body.removeChild(MENU.About.div); delete MENU.About.div}
|
||||||
};
|
};
|
||||||
|
MENU.About.Keydown = function(event) {
|
||||||
|
if (event.keyCode === KEY.ESCAPE ||
|
||||||
|
(this.id === 'MathJax_AboutClose' &&
|
||||||
|
(event.keyCode === KEY.SPACE || event.keyCode === KEY.Return))) {
|
||||||
|
MENU.About.Remove(event);
|
||||||
|
}
|
||||||
|
},
|
||||||
MENU.About.GetJax = function (jax,JAX,type,noTypeCheck) {
|
MENU.About.GetJax = function (jax,JAX,type,noTypeCheck) {
|
||||||
var info = [];
|
var info = [];
|
||||||
for (var id in JAX) {if (JAX.hasOwnProperty(id) && JAX[id]) {
|
for (var id in JAX) {if (JAX.hasOwnProperty(id) && JAX[id]) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user