From 986ee52e8a4c38d0d85f909badf193c41a3a7599 Mon Sep 17 00:00:00 2001 From: zorkow Date: Sat, 29 Aug 2015 01:57:33 +0100 Subject: [PATCH] Focuses popup windows. --- unpacked/extensions/HelpDialog.js | 7 +++++-- unpacked/extensions/MathMenu.js | 10 ++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/unpacked/extensions/HelpDialog.js b/unpacked/extensions/HelpDialog.js index 09365fd26..440368281 100644 --- a/unpacked/extensions/HelpDialog.js +++ b/unpacked/extensions/HelpDialog.js @@ -101,7 +101,7 @@ HELP.Post = function () { this.div = MENU.Background(this); var help = HTML.addElement(this.div,"div",{ - id: "MathJax_Help" + id: "MathJax_Help", tabIndex: "0" },LOCALE._("HelpDialog",[ ["b",{style:{fontSize:"120%"}},[["Help","MathJax Help"]]], ["div",{id: "MathJax_HelpContent"},[ @@ -148,10 +148,13 @@ ] ]], ["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', + 'aria-label': 'Close', 'aria-describedby': 'Close window'}, [["span",{},["\u00D7"]]] ] ])); + help.focus(); LOCALE.setCSS(help); var doc = (document.documentElement||{}); var H = window.innerHeight || doc.clientHeight || doc.scrollHeight || 0; diff --git a/unpacked/extensions/MathMenu.js b/unpacked/extensions/MathMenu.js index 5ac325c1b..01ff4e7ef 100644 --- a/unpacked/extensions/MathMenu.js +++ b/unpacked/extensions/MathMenu.js @@ -477,7 +477,6 @@ /* * Keyboard navigation of menu. */ - active: null, // The currently focused item. There can only be one! HTML! posted: false, // Is a menu open? GetNode: function(jax) { @@ -746,7 +745,6 @@ }, Label: function (def,menu) {return [this.Name()]}, - //TODO: Focus the popup. Mouseup: function (event,menu) { if (!this.disabled) { this.Remove(event,menu); @@ -973,7 +971,7 @@ ]]); MENU.About.div = MENU.Background(MENU.About); var about = HTML.addElement(MENU.About.div,"div",{ - id: "MathJax_About" + id: "MathJax_About", tabIndex:0 },[ ["b",{style:{fontSize:"120%"}},["MathJax"]]," v"+MathJax.version,["br"], _(font.replace(/ /g,""),"using "+font),["br"],["br"], @@ -983,9 +981,13 @@ "background-color":"#E4E4E4", padding:".4em .6em", border:"1px inset" }},jax],["br"],["br"], ["a",{href:"http://www.mathjax.org/"},["www.mathjax.org"]], - ["span",{className:"MathJax_MenuClose",id:"MathJax_AboutClose",onclick:MENU.About.Remove}, + ["span",{className:"MathJax_MenuClose",id:"MathJax_AboutClose", + onclick:MENU.About.Remove, + onkeydown:MENU.About.Remove, tabIndex:0, + 'aria-label': "Close", 'aria-describedby': "Close window"}, [["span",{},"\u00D7"]]] ]); + about.focus(); MathJax.Localization.setCSS(about); var doc = (document.documentElement||{}); var H = window.innerHeight || doc.clientHeight || doc.scrollHeight || 0;