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

MathJax removes any aria-label put on input mathml #502

Closed
jcayzac opened this issue Jun 17, 2013 · 11 comments

Comments

Projects
None yet
5 participants
@jcayzac
Copy link

commented Jun 17, 2013

I've noticed that MathJax 2.2 doesn't copy aria-label attributes from the input MathML to the span element it creates:

<math aria-label="3 times the identity matrix">
    <apply>
        <times/>
        <cn> 0 </cn>
        <matrix>
            <matrixrow>
                <cn> 1 </cn> <cn> 0 </cn> <cn> 0 </cn>
            </matrixrow>
            <matrixrow>
                <cn> 0 </cn> <cn> 1 </cn> <cn> 0 </cn>
            </matrixrow>
            <matrixrow>
                <cn> 0 </cn> <cn> 0 </cn> <cn> 1 </cn>
            </matrixrow>
        </matrix>
    </apply>
</math>

…becomes:

<span class="MathJax_SVG" id="MathJax-Element-2-Frame" role="textbox" aria-readonly="true" style="font-size: 100%; display: inline-block;">
    <svg xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 -1968.8903908297991 6927.276651322095 3437.7807816595982" style="width: 16.107ex; height: 7.992ex; vertical-align: -3.443ex; margin: 1px 0px;">
        <g stroke="black" fill="black" stroke-width="0" transform="matrix(1 0 0 -1 0 0)">
            <use xlink:href="#MJMAIN-30">
            </use>
            <use xlink:href="#MJMAIN-2B" x="727" y="0">
            </use>
            <g transform="translate(1732,0)">
                <g transform="translate(0,1950)">
                    <use xlink:href="#MJSZ4-239B" x="0" y="-1165">
                    </use>
                    <use xlink:href="#MJSZ4-239D" x="0" y="-2746">
                    </use>
                </g>
                <g transform="translate(1047,0)">
                    <g transform="translate(-15,0)">
                        <use xlink:href="#MJMAIN-30" x="0" y="1150">
                        </use>
                        <use xlink:href="#MJMAIN-30" x="0" y="-50">
                        </use>
                        <use xlink:href="#MJMAIN-31" x="0" y="-1250">
                        </use>
                    </g>
                    <g transform="translate(1290,0)">
                        <use xlink:href="#MJMAIN-31" x="0" y="1150">
                        </use>
                        <use xlink:href="#MJMAIN-30" x="0" y="-50">
                        </use>
                        <use xlink:href="#MJMAIN-30" x="0" y="-1250">
                        </use>
                    </g>
                    <g transform="translate(2595,0)">
                        <use xlink:href="#MJMAIN-30" x="0" y="1150">
                        </use>
                        <use xlink:href="#MJMAIN-31" x="0" y="-50">
                        </use>
                        <use xlink:href="#MJMAIN-30" x="0" y="-1250">
                        </use>
                    </g>
                </g>
                <g transform="translate(4314,1950)">
                    <use xlink:href="#MJSZ4-239E" x="0" y="-1164">
                    </use>
                    <use xlink:href="#MJSZ4-23A0" x="0" y="-2746">
                    </use>
                </g>
            </g>
        </g>
    </svg>
</span>
@jcayzac

This comment has been minimized.

Copy link
Author

commented Jun 17, 2013

Note: apparently it's the same for alttext attributes.

@fred-wang

This comment has been minimized.

Copy link
Contributor

commented Jun 27, 2013

@jcayzac The HTML5 validator seems to say that aria-label is invalid on the math root, so you'd better put it on a parent span/div. alttext is preserved if you use the MathML output jax, but I don't know where you want MathJax to attach the attribute when SVG/HTML-CSS is used since alttext is a MathML attribute and is likely to be invalid on SVG/HTML elements. By default, the mml2jax preprocessor uses the altext as a preview: http://docs.mathjax.org/en/latest/options/mml2jax.html#the-mml2jax-preprocessor

@pkra

This comment has been minimized.

Copy link
Member

commented Jun 27, 2013

A quick search gives me http://stackoverflow.com/questions/4697100/accessibility-recommended-alt-text-convention-for-svg-and-mathml

That being said, I do think we should preserve aria and alttext -- much like we (soon) preserve annotation-xml.

Perhaps we should ask the MathWG if aria might become valid?

@jcayzac

This comment has been minimized.

Copy link
Author

commented Aug 1, 2013

My understanding is that the <math> element in HTML5 is an HTML5 element with MathML content, not a MathML element (hence the lack of need to declare any namespace… also HTML5 is not XML), so HTML5 attributes would apply.

Anyway, both MathML and SVG have their own mechanism for providing fallback content to screen readers, so it should be possible to map from one to the other.

@dpvc dpvc modified the milestones: A future release, Bugfix Version Apr 9, 2014

@dpvc dpvc modified the milestones: A future release, Next Release Aug 19, 2014

dpvc pushed a commit to dpvc/MathJax that referenced this issue Sep 14, 2014

Davide P. Cervone
Preserve RDFa and other non-standard attributes from MathML elements …
…in the HTML-CSS or SVG output. Resolves issue mathjax#860, and also handles mathjax#502 as a side-effect.
@dpvc

This comment has been minimized.

Copy link
Member

commented Sep 14, 2014

The issue860 branch of my fork of MathJax addresses this issue. The SVG output now includes the aria-label from the <math> element, if there was one, and data from the alttext attribute will be put into an aria-label attribute if there isn't an aria-label already.

@dpvc

This comment has been minimized.

Copy link
Member

commented Nov 13, 2014

==> Merged (Nov. 2 with issue 860)

@dpvc dpvc added Merged and removed Ready for Review labels Nov 13, 2014

@dpvc dpvc closed this Nov 13, 2014

@pkra pkra self-assigned this Jan 16, 2015

pkra added a commit to mathjax/MathJax-test that referenced this issue Jan 20, 2015

@dpvc dpvc added Test Available and removed Test Needed labels Jan 20, 2015

@dpvc

This comment has been minimized.

Copy link
Member

commented Jan 20, 2015

==> In Testsuite

MathMLToDisplay/issue502.html

@dpvc dpvc added Fixed v2.5 and removed Merged labels Jan 30, 2015

@b1tzmast3r

This comment has been minimized.

Copy link

commented Apr 29, 2015

I noticed that the span MathJax_SVG has a role of math and the svg tag doesn't have a role attribute. Our tests have shown that putting role="img" on the svg tag will improve screen reader performance. Would you ever consider updating this?

Current Rendering:

<span class="MathJax_SVG" id="MathJax-Element-2-Frame" role="math"...>
<svg xmlns:xlink="http://www.w3.org/1999/xlink" aria-label="E equals M C squared" ...>

Recommendation:

<span class="MathJax_SVG" id="MathJax-Element-2-Frame"...>
<svg xmlns:xlink="http://www.w3.org/1999/xlink" role="img" aria-label="E equals M C squared"...">
@pkra

This comment has been minimized.

Copy link
Member

commented Apr 30, 2015

@b1tzmast3r could you open a new issue to discuss this? Thanks!

@pkra

This comment has been minimized.

Copy link
Member

commented Apr 30, 2015

FWIW, I don't think it should be img; graphic/diagram seems more fitting but we'll have to do some research.

@b1tzmast3r

This comment has been minimized.

Copy link

commented May 11, 2015

I've started a new issue for this:
#1192

Sorry for the delay...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.