Page MenuHomePhabricator

The MW_MATH_MATHML mode should expose the MathML to accessible tools
Closed, ResolvedPublic

Description

Currently, the MW_MATH_MATHML mode generates MathML + SVG & PNG fallback. However, the MathML is only visible on Gecko and other rendering engines fallback to SVG (or PNG for IE<9) for lack of good visual rendering for MathML.

For people with visual disabilities using accessible tools, the quality of the visual rendering is less important. We should consider a way to expose the MathML source to these tools. There are at least two of them:

  • VoiceOver with Safari. One problem is that the accessibility code relies on some information provided by the MathML "RenderObject", so information is lost when doing "display: none" on the <math>.
  • MathPlayer. I don't know if "display: none" affects its ability to read the MathML content (I think MathPlayer uses the DOM).

I guess we could do something similar to what we discuss the "enable MathJax" for anonymous users at some point, that is something to switch from SVG to MathML. That would also be useful for people willing to use the visual rendering of MathPlayer/WebKit.

Alternatively, when MW_MATH_MATHML becomes the default, I could easily write an add-on for safari to switch from SVG to MathML.


Version: master
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=70206

Details

Reference
bz66537

Related Objects

StatusSubtypeAssignedTask
ResolvedNone
ResolvedNone

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:23 AM
bzimport added projects: Future-Release, Math.
bzimport set Reference to bz66537.

... and of course there is also ChromeVox :-) I think it uses the DOM too but as for MathPlayer I don't know whether or not it will be able to read display=none MathML.

physik wrote:

Yes. That's very important.
But we should ensure that MathML is rendered in Production on Gecko for a large number of visitors in all Languages, before using it as default.

(In reply to physikerwelt from comment #2)

But we should ensure that MathML is rendered in Production on Gecko for a
large number of visitors in all Languages, before using it as default.

I'm not sure how Gecko's use affects other rendering engines. The idea here is just to have an option for non-Gecko engines to display MathML instead of the fallback when MW_MATH_MATHML is enabled (whether it is the default or chosed by registered users).

I wonder whether we want to try something like

https://github.com/Khan/KaTeX/issues/38#issuecomment-55802898

instead of the current "display: none;" on the <math> element. That's similar to what Chris Fleizach suggested to me by mail in the past. That would give a chance to tools based on the native WebKit accessibility tree (e.g. VoiceOver) to read the math. And the "aria-hidden" on the SVG fallback will still be important for DOM-based tools, I guess.

Change 164736 had a related patch set uploaded by Frédéric Wang:
Improve the way mathematical formulas are exposed to screen readers.

https://gerrit.wikimedia.org/r/164736

Change 164736 merged by Physikerwelt:
Improve the way mathematical formulas are exposed to screen readers.

https://gerrit.wikimedia.org/r/164736

physik wrote:

I'll deploy it to the preview server.

(In reply to physikerwelt from comment #7)

I'll deploy it to the preview server.

What is the URL of the preview server and can you tell me when it's live?

physik wrote:

I have it deployed to
http://math-preview.wmflabs.org/wiki/Main_Page
The MathML element reads now like
<dt>MathML</dt>
<dd><span><span class="mwe-math-mathml-inline" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML">

<mrow class="MJX-TeXAtom-ORD">
  <mstyle displaystyle="true">
    <mi>E</mi>
    <mo>=</mo>
    <mi>m</mi>
    <msup>
      <mi>c</mi>
      <mrow class="MJX-TeXAtom-ORD">
        <mn>2</mn>
      </mrow>
    </msup>
  </mstyle>
</mrow>

</math></span><img class="mwe-math-fallback-svg-inline" style="display: none; vertical-align: -0.167ex; margin-left: 0ex; margin-right: 0ex; margin: 1px 0px;height: 2.167ex; width: 9ex;" src="/w/index.php?title=Special:MathShowImage&amp;hash=826676a6a5ad24552f0d5af1593434cc&amp;mode=5" aria-hidden="true">
<img class="mwe-math-fallback-png-inline" src="/w/index.php?title=Special:MathShowImage&amp;hash=826676a6a5ad24552f0d5af1593434cc&amp;mode=0" aria-hidden="true">

Just FYI, MathJax-node can now produce speech-strings (using ChromeVox or MathSpeak rules). This way, both the MathML and the image rendering can become accessible to generic screenreaders (not just MathML-enabled ones).