MathJax icon indicating copy to clipboard operation
MathJax copied to clipboard

MathJax 4 in firefox with NVDA

Open RichCaloggero opened this issue 6 months ago • 1 comments

Issue Summary

Role of "img" used on speech output.

Steps to Reproduce:

  1. load mathjax into a webpage; by default mathjax4 comes up with the explorer enabled
    1. turn off braille generation

looking at the markup:

<mjx-speech aria-label="a is not equal to 0, math" role="img" aria-roledescription="‘"></mjx-speech>

In your reply to (now closed) issue #3399 you claimed that using a role such as "tree" instead of "application" is semantically incorrect. So why are you using a role of "img" on the generated speech as shown above?

Also in your comment to the aforementioned issue, you said that role of "application" is still used in mathjax4, however I cannot find it at all in the generated HTML.

Technical details:

  • MathJax Version: 4.0
  • Client OS: wondows 10
  • Browser: firefox 141.0.3

I am using the following MathJax configuration:

MathJax = {
loader: {
load: [
"input/asciimath",
"output/svg",
] // components
}, // loader
}; // MathJax configuration

and loading MathJax via

<script id="MathJax-script" defer src="https://cdn.jsdelivr.net/npm/mathjax@4/tex-mml-chtml.js"></script>

Supporting information:

RichCaloggero avatar Aug 14 '25 15:08 RichCaloggero

you claimed that using a role such as "tree" instead of "application" is semantically incorrect.

It is. And not just because the role is inappropriate, but because the interaction with some screen readers is inappropriate. Because the tree role is intended as a means of selecting items from a tree like a directory listing, the items are expected to be selected or not selected, and some screen readers read "selected" or "not selected" as you move among the leaves. Also, some say things like "first of eight" or other extra phrases that would be inappropriate for the expression explorer. The fact that items can be open or closed (like directories) means that some screen reader voice that as well. So the tree role was no an effective one in some of the browser/os/screen-reader combinations that we needed to support.

So why are you using a role of "img" on the generated speech as shown above?

Because it is basically the only one that works (a button role would also work, but we considered that to be a worse choice). The purpose of that node in the tree is that it holds the text to be read when a screen reader is reading the page as a whole (or in smaller chunks), but not actually focusing the math itself. It turns out to be difficult to get a setup that is actually read by all browser/os/screen-reader combinations in that setting, and after several months of working to achieve a solution that was successful across all the platforms we wanted to support, this was the mechanism that worked. While I would have loved to have used role="math", for example, that simply was ignored by some screen readers. When browsers and screen readers have better support for that role, we may be able to switch, but for now, this is a pragmatic choice. Also, in the past, the image role was what was recommended for mathematical output. Because the aria-roledescription is set to "math" (or another phrase controlled by the contextual menu), the user should not notice that this is an image role, with the exception of navigating by images.

you said that role of "application" is still used in mathjax4, however I cannot find it at all in the generated HTML.

It is used on transient elements that are inserted and removed during the expression exploration, so they are a bit hard to get your hands on. But if you look at the element inspector in the developer tools and open a mjx-container and scroll to where the mjx-speech element that you indicate above, then focus the expression, you should see them come and go just above that element.

dpvc avatar Aug 15 '25 17:08 dpvc