How to activate MathJax accessibility by default?

Viewed 276

I've searched the documentation back and forth, and couldn't find a way to activate the accessibility feature by default. Only by right click on a Mathjax element to open the context menu, and select accessibility->activate.

The documentation reads: "The extension can be activated either via the context menu, which itself is fully accessible, or by default using configuration options. "

But I couldn't find any mention of how to activate it using the configuration. This is the configuration I found, and there's no "activate" option there.

What am I missing?

(I'm using the latest MathJax version: 3.0)

This is how I configure my MathJax, and below is the context menu I'm getting, where the accessibility option is not activated.

MathJax = {
   tex: {
     inlineMath: [['##', '##'], ['\\(', '\\)']]
   },
   options: {
       a11y: {
          speech: true,   
          subtitles: true
       }
  }
};

The option I want to set is marked in red

3 Answers

After two days of digging in the documentation, I gave up. I don't think it's possible to activate the accessibility feature by default. Personally I think it's absurd, because how on earth is a blind person supposed to guess how to activate it if the screen reader isn't reading it?

Eventually, what I did was to hide a div in a top location in every page, with instructions on how to activate the plug in. I'm using css to hide that div from all users, and expose it to screen readers like so:

  .accessibility_hint{font: 400 12px arial; color: #0e2d6d; background-color: white; position: absolute; left: 50%; margin-left: -55px; top: 0px; padding: 2px 4px; opacity: 0;}
 .accessibility_hint:focus, .accessibility_hint:active{opacity: 1; z-index:999;} 
the div is here. you'll see it only if you use keyborad navigation to focus on it
    <div class=accessibility_hint tabindex=0>[insert textual explanation on how to use keyboard navigation to activate the plug-in]</div>

  

Directly below the yellow configuration options box it states all of the accessibility options:-

I think you were thrown by the use of a11y instead of AccessibilitY in the description - this is a numeronym for the word 'Accessibility'. This is the same as things like i18n (InternationalisatioN)

Yes I am aware of the irony that this is not very accessible and they should just use the word!

If you configure all of the options they will be on by default, you don't need 'activate' - that is done by including ally and it's sub options. (please note you may need to use enrichSpeech: 'shallow' or enrichSpeech: 'deep' if you want to add additional info to the screen reader output.)

MathJax = {
  options: {
    a11y: { //everything within here will be on if you set that item to a 'truthy' statement i.e. speech: true

(This is a bit long for a comment). Here are some slides from a conference talk, November 2019, given by one of the main developers of MathJax. To quote from it:

Switching on Accessibility

  • Navigate down to the Accessibility submenu entry

  • Open the submenu entry

  • Hit the Activate command

and

MathJax Cookie

  • MathJax uses a cookie to remember menu settings

  • Anything explicitly set in the menu will always overwrite settings made by the content/page author.

  • Thus a user can always retain their personal setting

  • They are retained until cookies for a page are deleted

There is discussion of settings via Javascript, but nothing about how to switch on accessibility programmatically. I would hence say that the current behaviour is "by design".

This seems odd to me, for the reasons @einav explains in his answer. That said, while I am not a screen-reader user, from my extremely limited understanding of how screen readers work, I think it should be obvious that the context menu exists, and the user will probably be expecting this behaviour from MathJax. This thinking might explain the design decision.

Related