Closed danieldanhe closed 2 years ago
This is not a problem in this library but in MathJax itself.
You can see for yourself in the following sandbox where only pure MathJax is used that typesetting the same content anew results in added nested content in the assistive element (every new typesetting results in another layer of nesting). In better-react-mathjax
with default settings, there is both typesetting on startup and then explicit typesetting in the React component, therefore it results in one layer of nested content in the assistive element.
Check the sandbox and observe the element and how a new layer of nesting is added every time you press TYPESET:
https://codesandbox.io/s/better-react-mathjax-20-m8uf2c
I have filed an issue with MathJax source repo: https://github.com/mathjax/MathJax/issues/2892
I will close this if ok with you? Thanks for reporting!
This will be fixed in an upcoming release in MathJax. See https://github.com/mathjax/MathJax/issues/2892 for workarounds in the meantime.
MathJax generates assistive MathML inside each equation for accessibility, but this assistive MathML is processed again. For example, go to https://3vsr5.csb.app/ and tab through the page. You'll find that half the tab targets belong to the equations and the other half belong to an invisible element—the processed assistive MathML. You can also inspect the DOM and see a
<mjx-container>
element inside of a<mjx-assistive-mml>
element.