Closed pkra closed 8 years ago
I'm wondering if this isn't mostly of an upstream issue.
The check for pushing to the alttext attribute is obviously something to fix.
But once that's done, should MathJax take care of the correct markup? I.e., use title and labeled-by for SVG and for CommonHTML, set aria-hidden to the first child (that's technically not necessary but worthwhile to be sure AT won't do anything funky).
But once that's done, should MathJax take care of the correct markup?
I realized that this wouldn't help since the timing isn't right. The changes to root.alttext
won't affect SVG and HTML output. Not sure if we want to change that. I'll fix this locally in GetSVG
and GetHTML
.
I suppose there is also the question of which should take precedence, the alttext
from the math node, or the speech text. If you think of adding speech as the default action, an element with alttext
could be considered to be an element with data that overrides the default.
If the application wants to replace existing alttext
attributes with speech text, then it should make sure that alttext
attributes are removed before passing the math to MathJax for processing. That seems to be more in line with the current approach of pushing more responsibility onto the calling program.
Fair point. I don't really mind either way around. There's also #206 which makes it somewhat moot if we go ahead with that.
@zorokow any thoughts?
I'm not sure I understand your point about 206. The changes you made here are for mj-single, but 206 is about mj-page, right?
Sorry, typo. I mean #207.
OK, that makes more sense. Thanks.
==> Merged.
[Splitting this from https://github.com/mathjax/MathJax-node/issues/121#issuecomment-190666132]
If MathML input has
alttext
and mathjax-node is set to generate output with speechtext, then we get a duplication.For MathML, the source alttext is changed to the speechtext but the attribute is duplicated in the output. This is due to a check missing at https://github.com/mathjax/MathJax-node/blob/master/lib/mj-single.js#L544
For HTML, the speechtext is added as an aria-label on the outer span; the source alttext is added to its first child (but that's in an aria-hidden element). This is due to https://github.com/mathjax/MathJax-node/blob/develop/lib/mj-single.js#L570-L574
For SVG output, the source
alttext
ends up on an aria-label (because of https://github.com/mathjax/MathJax/blob/develop/unpacked/jax/output/SVG/jax.js#L2111) and the speechtext ends up in atitle
tag pointed to by anaria-labeledby
(due to https://github.com/mathjax/MathJax-node/blob/master/lib/mj-single.js#L575-L585).Examples;
MML
produces
HTML
produces
SVG
will produce