diff --git a/assets/pg/Student_Orientation/explorerfull.png b/assets/pg/Student_Orientation/explorerfull.png index 6b52703fcc..c791cefdaf 100644 Binary files a/assets/pg/Student_Orientation/explorerfull.png and b/assets/pg/Student_Orientation/explorerfull.png differ diff --git a/assets/pg/Student_Orientation/explorerpiece.png b/assets/pg/Student_Orientation/explorerpiece.png index a4fb755b36..c47d879cb7 100644 Binary files a/assets/pg/Student_Orientation/explorerpiece.png and b/assets/pg/Student_Orientation/explorerpiece.png differ diff --git a/assets/pg/Student_Orientation/mathInteraction.pg b/assets/pg/Student_Orientation/mathInteraction.pg index 3cf56a7111..f8f0c11fc5 100644 --- a/assets/pg/Student_Orientation/mathInteraction.pg +++ b/assets/pg/Student_Orientation/mathInteraction.pg @@ -26,7 +26,7 @@ Once focus is on a math expression, using the space bar will activate the "MathJ by right-clicking (Windows/Linux) or [|control|]*-clicking (MacOS) a piece of math. Try activating the MathJax menu now. It should look like the following. ->> [!MathJax contextual menu!]{'mathjaxmenu.png'} << +>> [!MathJax contextual menu!]{'mathjaxmenu.png'}{140} << There are many features that help you to engage with math content. Explore the menu options to survey what is available. @@ -36,9 +36,9 @@ vision disabilities see the content better. And it may help all users to see som a moment to explore these settings and select options that you would be comfortable with. (Of course you can change these settings at any time.) -Also in the main menu, there is an "Accessibility" submenu. In that menu, if accessibility is not already activated, -select "Activate". After activating this, you may need to refresh the web page to see the math expression again. Now you -have the option to see math content verbalized. To do this, place focus onto a math expression and hit [|enter|]*. +Also in the main menu, there is an "Accessibility" submenu. Accessibility is enabled by default, but you can also select +"Show Subtitles" in the "Speech" submenu. This allows you to see math content verbalized. To do this, place focus onto +a math expression and hit [|enter|]*. * At first, the entire expression is highlighted and there will be a verbal rendering of the expression. [!Speech string for the quadratic formula!]{'explorerfull.png'}{600} * Use the down arrow to navigate "down" into a smaller piece of the math expression. @@ -47,16 +47,16 @@ have the option to see math content verbalized. To do this, place focus onto a m you can see a verbalization for just this part of the expression above: [!Speech string for the radicand of the quadratic formula!]{'explorerpiece.png'}{600} * Return to the MathJax menu, Accessibility submenu, to explore options for how this explorer tool works. -* Under "Speech" you will find options to use MathSpeak, ClearSpeak, or ChromeVox rules. The default is to use -"MathSpeak verbose" rules, which try try to read math "literally" without context. For example, it reads [`(1,3)`] as -"left parenthesis 1 comma 3 right parenthesis". Other speech rules can produce more meaningful verbal renderings. For -example with the right ClearSpeak settings, the same math expression produces "the point with coordinates 1 comma 3" -or "the interval from 1 to 3 not including 1 or 3". +* Under "Speech" you will find options for MathSpeak and ClearSpeak rules. The default is to use "MathSpeak verbose" +rules, which try try to read math "literally" without context. For example, it reads [`(1,3)`] as "left parenthesis 1 +comma 3 right parenthesis". Other speech rules can produce more meaningful verbal renderings. For example with the right +ClearSpeak settings, the same math expression produces "the point with coordinates 1 comma 3" or "the interval from 1 to +3 not including 1 or 3". Some keyboard-navigating users might find it undesirable for each piece of math content to be tab-indexed. If this is -the case, then in the "Accessibility" sub menu you can uncheck "Include in Tab Order". Just note that in order to undo -this and make math content tabbable again, you will need to access the menu, and so you will need some way other than -tabbing to bring focus back to a piece of math content. +the case, then in the "Options" sub menu of the "Accessibility" submenu you can uncheck "Include in Tab Order" and +"Semantic Enrichment". Just note that in order to undo this and make math content tabbable again, you will need to +access the menu, and so you will need some way other than tabbing to bring focus back to a piece of math content. END_BODY $images = < '', HTML=> '' }; $pg{specialPGEnvironmentVars}{problemPostamble} = { TeX => '', HTML=>'' }; -# this snippet checks to see if Moodle has already called MathJax -# $pg{specialPGEnvironmentVars}{problemPreamble} = { TeX => '', HTML=> < -# if (MathJax.Hub.Startup.params.config && MathJax.Hub.config.config.length) { -# MathJax.Hub.Config({ -# config: [], -# skipStartupTypeset: false -# }); -# } -# -# END_PREAMBLE - -# -# $pg{specialPGEnvironmentVars}{problemPostamble} = { TeX => '', HTML=> <\n!; -#$pg{specialPGEnvironmentVars}{problemPostamble}{HTML}= qq!\n!; - -# To have the problem body indented and boxed, uncomment: -# $pg{specialPGEnvironmentVars}{problemPreamble}{HTML} = '
-#
'; -# $pg{specialPGEnvironmentVars}{problemPostamble}{HTML} = '
-#
'; +# Note: problemPreamble and problemPostamble are depreciated, so don't use them. ##### PG modules to load diff --git a/conf/localOverrides.conf.dist b/conf/localOverrides.conf.dist index 22900b2d96..f8c90710d9 100644 --- a/conf/localOverrides.conf.dist +++ b/conf/localOverrides.conf.dist @@ -435,25 +435,6 @@ $mail{feedbackRecipients} = [ # use this setting when running Rserve in a docker container. #$pg{specialPGEnvironmentVars}{Rserve} = {host => "r"}; - -################################################################################ -# Serving Opaque client questions to moodle -################################################################################ - - -# this snippet checks to see if Moodle has already called MathJax -# $pg{specialPGEnvironmentVars}{problemPreamble} = { TeX => '', HTML=> < -# if (MathJax.Hub.Startup.params.config && MathJax.Hub.config.config.length) { -# MathJax.Hub.Config({ -# config: [], -# skipStartupTypeset: false -# }); -# } -# -# END_PREAMBLE - ################################################################################ # Authentication ################################################################################ diff --git a/htdocs/js/MathJaxConfig/mathjax-config.js b/htdocs/js/MathJaxConfig/mathjax-config.js index 937f33393f..c998d67ce5 100644 --- a/htdocs/js/MathJaxConfig/mathjax-config.js +++ b/htdocs/js/MathJaxConfig/mathjax-config.js @@ -98,24 +98,6 @@ if (!window.MathJax) { AM.symbols.splice(i, 0, { input: trigger, ...newTriggers[trigger].symbols }); } - // The following is a workaround for a bug in MathJax when the math renderer is changed. - // Note that this should be removed when we have upgraded to MathJax 4. - const { STATE } = MathJax._.core.MathItem; - const { Menu } = MathJax._.ui.menu.Menu; - const { mathjax } = MathJax._.mathjax; - Menu.prototype.rerender = function (start = STATE.TYPESET) { - this.rerenderStart = Math.min(start, this.rerenderStart); - if (!Menu.loading) { - if (this.rerenderStart <= STATE.COMPILED) this.document.reset({ inputJax: [] }); - MathJax.startup.promise.then(() => { - mathjax.handleRetriesFor(() => { - this.document.rerender(this.rerenderStart); - this.rerenderStart = STATE.LAST; - }); - }); - } - }; - return MathJax.startup.defaultReady(); } }, diff --git a/htdocs/js/System/system.scss b/htdocs/js/System/system.scss index c6a9468d58..09c486b10a 100644 --- a/htdocs/js/System/system.scss +++ b/htdocs/js/System/system.scss @@ -1054,3 +1054,7 @@ td.alt-source { width: 100%; } } + +mjx-help-background { + z-index: 1055; +} diff --git a/htdocs/package-lock.json b/htdocs/package-lock.json index 097797ff47..063de3c309 100644 --- a/htdocs/package-lock.json +++ b/htdocs/package-lock.json @@ -15,7 +15,7 @@ "jquery": "^3.7.1", "jquery-ui-dist": "^1.13.3", "luxon": "^3.7.1", - "mathjax": "^3.2.2", + "mathjax": "^4.0.0", "minisearch": "^7.1.2", "shortcut-buttons-flatpickr": "^0.4.0", "sortablejs": "^1.15.6" @@ -317,6 +317,12 @@ "integrity": "sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g==", "license": "MIT" }, + "node_modules/@mathjax/mathjax-newcm-font": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@mathjax/mathjax-newcm-font/-/mathjax-newcm-font-4.0.0.tgz", + "integrity": "sha512-kpsJgIF4FpWiwIkFgOPmWwy5GXfL25spmJJNg27HQxPddmEL8Blx0jn2BuU/nlwjM/9SnYpEfDrWiAMgLPlB8Q==", + "license": "Apache-2.0" + }, "node_modules/@openwebwork/codemirror-lang-pg": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/@openwebwork/codemirror-lang-pg/-/codemirror-lang-pg-0.0.3.tgz", @@ -1544,9 +1550,13 @@ } }, "node_modules/mathjax": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/mathjax/-/mathjax-3.2.2.tgz", - "integrity": "sha512-Bt+SSVU8eBG27zChVewOicYs7Xsdt40qm4+UpHyX7k0/O9NliPc+x77k1/FEsPsjKPZGJvtRZM1vO+geW0OhGw==" + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mathjax/-/mathjax-4.0.0.tgz", + "integrity": "sha512-ThMPHiPl9ibZBInAmfoTCNq9MgCdH7ChIQ9YhKFc325noJ4DMzy9/Q14qdcuPzVJjEmC3kyXhwnERZWX3hbWzQ==", + "license": "Apache-2.0", + "dependencies": { + "@mathjax/mathjax-newcm-font": "^4.0.0" + } }, "node_modules/mdn-data": { "version": "2.12.2", @@ -2764,6 +2774,11 @@ "resolved": "https://registry.npmjs.org/@marijn/find-cluster-break/-/find-cluster-break-1.0.2.tgz", "integrity": "sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g==" }, + "@mathjax/mathjax-newcm-font": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@mathjax/mathjax-newcm-font/-/mathjax-newcm-font-4.0.0.tgz", + "integrity": "sha512-kpsJgIF4FpWiwIkFgOPmWwy5GXfL25spmJJNg27HQxPddmEL8Blx0jn2BuU/nlwjM/9SnYpEfDrWiAMgLPlB8Q==" + }, "@openwebwork/codemirror-lang-pg": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/@openwebwork/codemirror-lang-pg/-/codemirror-lang-pg-0.0.3.tgz", @@ -3444,9 +3459,12 @@ "integrity": "sha512-RkRWjA926cTvz5rAb1BqyWkKbbjzCGchDUIKMCUvNi17j6f6j8uHGDV82Aqcqtzd+icoYpELmG3ksgGiFNNcNg==" }, "mathjax": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/mathjax/-/mathjax-3.2.2.tgz", - "integrity": "sha512-Bt+SSVU8eBG27zChVewOicYs7Xsdt40qm4+UpHyX7k0/O9NliPc+x77k1/FEsPsjKPZGJvtRZM1vO+geW0OhGw==" + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mathjax/-/mathjax-4.0.0.tgz", + "integrity": "sha512-ThMPHiPl9ibZBInAmfoTCNq9MgCdH7ChIQ9YhKFc325noJ4DMzy9/Q14qdcuPzVJjEmC3kyXhwnERZWX3hbWzQ==", + "requires": { + "@mathjax/mathjax-newcm-font": "^4.0.0" + } }, "mdn-data": { "version": "2.12.2", diff --git a/htdocs/package.json b/htdocs/package.json index 8983c9beb1..d9aa3a4325 100644 --- a/htdocs/package.json +++ b/htdocs/package.json @@ -21,7 +21,7 @@ "jquery": "^3.7.1", "jquery-ui-dist": "^1.13.3", "luxon": "^3.7.1", - "mathjax": "^3.2.2", + "mathjax": "^4.0.0", "minisearch": "^7.1.2", "shortcut-buttons-flatpickr": "^0.4.0", "sortablejs": "^1.15.6" diff --git a/lib/FormatRenderedProblem.pm b/lib/FormatRenderedProblem.pm index 0008598468..47756e94cf 100644 --- a/lib/FormatRenderedProblem.pm +++ b/lib/FormatRenderedProblem.pm @@ -90,12 +90,12 @@ sub formatRenderedProblem { [ 'node_modules/jquery/dist/jquery.min.js', 0, {} ], [ 'node_modules/jquery-ui-dist/jquery-ui.min.js', 0, {} ], [ 'node_modules/iframe-resizer/js/iframeResizer.contentWindow.min.js', 0, {} ], - [ 'js/MathJaxConfig/mathjax-config.js', 0, { defer => undef } ], - [ 'node_modules/mathjax/es5/tex-svg.js', 0, { defer => undef, id => 'MathJax-script' } ], - [ 'node_modules/bootstrap/dist/js/bootstrap.bundle.min.js', 0, { defer => undef } ], - [ 'js/Problem/problem.js', 0, { defer => undef } ], - [ 'js/System/system.js', 0, { defer => undef } ], - [ 'math4-overrides.js', 1, { defer => undef } ] + [ 'js/MathJaxConfig/mathjax-config.js', 0, { defer => undef } ], + [ 'node_modules/mathjax/tex-svg.js', 0, { defer => undef } ], + [ 'node_modules/bootstrap/dist/js/bootstrap.bundle.min.js', 0, { defer => undef } ], + [ 'js/Problem/problem.js', 0, { defer => undef } ], + [ 'js/System/system.js', 0, { defer => undef } ], + [ 'math4-overrides.js', 1, { defer => undef } ] ); # Get the requested format. diff --git a/templates/layouts/system.html.ep b/templates/layouts/system.html.ep index d9af1c26e7..f2b0be7f1b 100644 --- a/templates/layouts/system.html.ep +++ b/templates/layouts/system.html.ep @@ -25,8 +25,8 @@ % # JS Loads <%= javascript $c->url({ type => 'webwork', name => 'htdocs', file => 'js/MathJaxConfig/mathjax-config.js' }), defer => undef =%> -<%= javascript $c->url({ type => 'webwork', name => 'htdocs', file => 'node_modules/mathjax/es5/tex-svg.js' }), - id => 'MathJax-script', defer => undef =%> +<%= javascript $c->url({ type => 'webwork', name => 'htdocs', file => 'node_modules/mathjax/tex-svg.js' }), + defer => undef =%> <%= javascript $c->url({ type => 'webwork', name => 'htdocs', file => 'node_modules/jquery/dist/jquery.min.js' }) %> <%= javascript $c->url({ type => 'webwork', name => 'htdocs',