Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assistive Technology can't be disabled #2651

Closed
plouffed opened this issue Mar 15, 2021 · 5 comments
Closed

Assistive Technology can't be disabled #2651

plouffed opened this issue Mar 15, 2021 · 5 comments
Labels
Accepted Issue has been reproduced by MathJax team Fixed Test Needed v3
Milestone

Comments

@plouffed
Copy link

plouffed commented Mar 15, 2021

Issue Summary

I installed my own copy of the project from npm and I am not able to turn off assistive technology.
Everything works just fine, but it breaks when I try to disable.

Also, I am confuse about the line
sre.Variables.url="https://cdn.jsdelivr.net/npm/speech-rule-engine@"+sre.Variables.VERSION+"/lib/mathmaps in the file es5/sre/sre_browser.js.

Why it doesn't load from my local copy?

Steps to Reproduce:

When I add this configuration:

MathJax = { options: { enableEnrichment: false, // false to disable enrichment } };
(as the documentation said http://docs.mathjax.org/en/latest/options/accessibility.html)

I get this error:
MathJax(?): Invalid option "enableEnrichment" (no default value).

The same thing happen with this configuration: MathJax = { options: { enableComplexity: false, } };
which give this error: MathJax(?): Invalid option "enableComplexity" (no default value).
@plouffed plouffed changed the title Can't disable assistive technology Assistive Technology can't be disabled Mar 15, 2021
@dpvc dpvc added Accepted Issue has been reproduced by MathJax team v3 labels Mar 16, 2021
@dpvc
Copy link
Member

dpvc commented Mar 16, 2021

Can you be a little clearer about your setup? Can you provide the code that sets up and runs MathJax? Are you running this in node, or in a browser?

Also, there are a number of assistive components, so when you say "turn off assistive technology" is not clear which one you really mean. Do you mean the assistive MathML that is produced automatically? To disable that, use

MathJax = {
  options: {
    enableAssistiveMml: false
  }
};

It turns out that the enableEnrichment option is only available after the semantic-enrich extension is loaded (and similarly for enableComplexity), and these aren't loaded until they are requested using the MathJax contextual menu. That is why you are getting those messages, most likely. That should be fixed.

As for the location that SRE uses for the maps, that can be configured in the HTML file using an SRE configuration script, or in a node application using SRE.setupEngine(). But if you are running this in node on a server, you should be using sre-node.js rather than sre_browser.js, which will use your local node_modules copy of SRE and its maps. That should be selected automatically when you are in a node setting, but I can't tell without more details about your code.

@plouffed
Copy link
Author

I run MathJax in my browser, and I mostly use google chrome.

My setup is pretty basic. I installed MathJax using npm command npm install mathjax@3.
Then I included this script


<script>
  MathJax = {
    options: {
      enableMenu: false,
      //enableComplexity: false,
      //enableEnrichment: false,
    }
  };
</script>
<script type="text/javascript" id="MathJax-script" async src="/node_modules/mathjax/es5/tex-svg-full.js"></script>

My point on doing all that is to keep just the bare minimum to make it run fast.

When I found that sre_browser.js was loading a file called en.js, I thought that maybe it was the bottleneck.
So I start searching on the documentation to prevent it from loading and here I am now.

Since I didn't know how to configure sre_browser, I just erase the sre.Variables.url. It doesn't load the en.js file anymore, but it still search for and it didn't make much difference on the speed. I also have to change the ajax call in sre_browser to make it asynchronous.

I don't know how enableEnrichment and enableComplexity works, but every time I refresh my web page, I see that mml.js, sre_browser.js, en.js, semantic-enrich.js and explorer.js loading.

Do we really need all those to parse mathematical formulas in the browser?

I try the option you proposed (enableAssistiveMml: false) and mml.js is still loading.

@dpvc
Copy link
Member

dpvc commented Mar 16, 2021

Have you activated those assistive tools in the MathJax contextual menu? If so, that will cause Mathjax to load the assistive tools (the changes in the menu are sticky so will stay in effect). You can select the "Reset to defaults" in the "Math Settings" submenu to reset all the menu settings (which should turn off those features). Then reload the page and see if you still see them. The menu settings override the page settings, so that is probably what is causing them to load.

@plouffed
Copy link
Author

You got it Mr. Davide P. Cervone!! It works like a charm now.. But I must admit that I couldn't have the contextual menu back by switching enableMenu. I just went in my browser localstorage and deleted the MathJax setting.

So maybe there is a problem there, it doesn't seem to change according to the updated MathJax setup.

@dpvc
Copy link
Member

dpvc commented Mar 16, 2021

it doesn't seem to change according to the updated MathJax setup.

Depending on how the javascript is packaged, some browsers may not clear it from cache, so you may not have gotten the updated version when you changed the enableMenu. In any case, you seem to have it working now, so I will close the issue.

@dpvc dpvc closed this as completed Mar 16, 2021
dpvc added a commit to mathjax/MathJax-src that referenced this issue Apr 14, 2021
Add a11y enable options to menu handler so that they can be configured (mathjax/MathJax#2651)
@dpvc dpvc added Merged Merged into develop branch Test Needed labels Apr 14, 2021
@dpvc dpvc added this to the 3.1.3 milestone Apr 14, 2021
@dpvc dpvc added Fixed and removed Merged Merged into develop branch labels Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Issue has been reproduced by MathJax team Fixed Test Needed v3
Projects
None yet
Development

No branches or pull requests

2 participants