-
Notifications
You must be signed in to change notification settings - Fork 14
Should all MathML elements really be potential hyperlinks / match :visited? #142
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
Comments
certainly the linking is used and worth keeping, in practice they are almost always used with token elements so if that would simplify the implementation could consider restricting href to token elements in core at least. |
Yes, href is necessary otherwise you can't create a link for a subformula, only the whole formula. MathML3 basically allows it on all elements and it was a replacement for the xlink::href attributes: https://www.w3.org/TR/MathML3/chapter6.html#interf.link We have some stats in w3c/mathml#55 although we didn't ask this explicitly, probably we should? For consistency with HTML and SVG, I guess it makes sense to restrict it to only a container element (rather than to all MathML elements), which would be |
forcing it on mrow would make the mathml a lot more verbose than it already is (in our mathml for example almost every mi is a link) allowing href on all (or most) elements was explicitly raised with whatwg at the time of the mathml integration and the feedback we had at the time was that (as far people were interested in implementing mathml at all) the href attribute wouldn't be a problem. |
I have all elements, although math, mrow, and leaf elements is a reasonable
compromise if it is hard to implement. For full, a polyfill could add an
mrow in that case.
Neil
…On Sat, Aug 10, 2019 at 12:23 AM David Carlisle ***@***.***> wrote:
forcing it on mrow would make the mathml a lot more verbose than it
already is (in our mathml for example almost every mi is a link) allowing
href on all (or most) elements was explicitly raised with whatwg at the
time of the mathml integration and the feedback we had at the time was that
(as far people were interested in implementing mathml at all) the href
attribute wouldn't be a problem.
if it was mrow and token elements (mi,mn,mtext,ms) then that would cover
all proactical cases
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<https://github.com/mathml-refresh/mathml/issues/125?email_source=notifications&email_token=AALZM3F37RR4HI26VQICSALQDZUIHA5CNFSM4IKTJESKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4AH6WA#issuecomment-520126296>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AALZM3HPHD4DYY6DKI5QYMTQDZUIHANCNFSM4IKTJESA>
.
|
For the record, Gecko has a test for this: https://searchfox.org/mozilla-central/source/layout/style/test/test_visited_reftests.html ; not sure how easy it is to write one with WPT. |
After a bunch of discussion at/driven by conversations at our hackfest, I believe (and I think @NSoiffer agrees) that we should limit this to token elements. I'm not entirely sure that I really understand the real need since So, for simplicty sake, is there any objection to limiting it? |
Not really, I have some mrow href... eg the 1..n link in https://www.nag.co.uk/numeric/nl/nagdoc_27/flhtml/f08/f08upf.html#jfail (which is native mathml rendering if you use firefox, mathjax otherwise) but in the full collection there, there are 30 |
Note that there are existing content and tests using href on mrow. Technically:
We need to update https://html.spec.whatwg.org/#dom-tabindex to indicate which element should have tabindex 0. Currently, we only test mrow: https://w3c-test.org/mathml/relations/html5-tree/tabindex-001.html |
The current discussion on #63 really belongs here, so I'm commenting on this issue in the hope the discussion returns to this issue... There was some discussion about MathML should be like HTML/SVG. SVG does have a In https://github.com/mathml-refresh/mathml/issues/152#issuecomment-583440328, @bzbarsky wrote:
I can imagine anytime there is a link, there is a much that might need to be updated. What I'm unclear on is why the number of elements that might have a link is the issue as opposed to the number of links. It seems (from my naive point of view), you just need to find the elements that have a link (which in MathML is any element with an href attribute). Why would it make a difference if the number of elements with a potential |
Yes, but those don't act as "links", just like the
This is the "There are some things that can be done to optimize this, but they're fragile and complicated" bit from that comment. Yes, you can do this, but maintaining that state is a pain and slows down various DOM mutations and whatnot. |
Links have all kinds of specialness, so it seems there's a lot of questions that wind up tying into this... The 'linky things that support href' (
There's a bunch of other tendrils here too I guess - they affect So, I think there's two fundamental questions here that go to the aims of this initial work:
|
My personal opinion is that ability to link any subset of MathML formulas is an interesting feature. I'm not sure it is as fundamental as other things we are working on though. So I'd be happy to either ignore links for now (with some clever polyfill) OR introduce a new backward-incompatible |
I have created a relevant pull request for the specification based on our conversation last week - however, in discussing with @fred-wang I think that we agree we'd like to discuss whether it might be a good choice/compromise to make this for token elements natively (most existing content) and think about adding an |
Wouldn't the new Given how hard you're pushing for this, and re-raising it, I feel I must be missing something? What does not allowing href on mrow give you? (given that content authors could simply use From compatibility and language design points of view, adding |
Resolved: all leaf elements and mrow should support href and it's related properties; no other element should. Need to write some tests. Brian submitted changes to the core spec. |
As per the MathML core meeting on 2/320, I was tasked to look into some accessibility issues related to href not being present on an element that can have it. The issue that @bkardell raised is that I asked a colleague who is very knowledgeable about accessibility and he said he was sure that was not legal. That caused me to look things up and indeed it is legal:
I tried out the following example in Chrome and Firefox (I know, it could have been written better):
The results are the same in Chrome and Firefox for the I was a bit surprised that NVDA worked as I would want when there is no href (i.e., tabbing would not stop there). I think all screen readers will work the same. In both Firefox and Chrome, the accessibility tree does not show focus in those cases (there is no tabindex in the tree, just is the node focusable or not). So apparently some group (ARIA?) specified the behavior so that AT works well. However, I don't see it in API Mappings 1.1. In fact, that spec says
Not sure what is going on since that is not what Firefox and Chrome do. Seems like the implementations do the right thing (and hence inheriting their behavior is good) and that the mapping spec needs a bug fix... |
I was about to post a new issue on this, but actually it ties in here. Re. Brian's comment above about links having "all kinds of specialness" - a special aspect they need but that no-one has listed yet is alternative text to describe the link purpose in order to meet accessibility criteria (ref). The "alt" attribute in HTML covers this, but there isn't - yet - an equivalent for general MathML elements, just the "alttext" on the root I'm not a WCAG expert so while it seems clear to me that some sort of "alt" attribute is required, I'm prepared to be corrected on this. But we're outputting MathML to PDF and I'm much more familiar with the equivalent specifications there (chiefly ISO14289). This requires alternative text on all links, not just those where the "purpose of each link can be determined from the link text alone" (as described in WCAG). So to meet this criteria, some sort of "alt" attribute is essential. |
Your point about "alt" and accessibility is a good one. In general, it isn't needed because links on MathML elements would normally have an obvious purpose (a definition or clarification of the symbol/notation) and therefore would meet the accessibility criteria. However, it is possible that someone might use them for some other reason, so it makes sense to allow for "alt" to be used on the MathML elements that accept "alt". I'm on the 14289 committee and will suggest amending the text of 14289-2 to be consistent with WCAG. Thanks for pointing that out! Unfortunately that doesn't help you now as 14289-2 is still a work in progress. |
I have a middle ground idea, but I am unsure if it is feasible from an implementation perspective. Could MathML Core both:
This could address the backwards compatibility question for existing docs, while also starting on the path to web platform uniformity. |
@dginev that's not a middle ground, that's "why not both". I think we shouldn't support both, that seems more confusing and it doesn't address the XSS issue. |
@zcorpan Endorsing both Also, what XSS issue? Simply reading through the link you shared |
Your suggestion was to support
The concern is that some existing sanitizers, if configured to allow |
No, it's very carefully not that. It's to degrade A conforming sanitizer would then degrade Maybe that's not possible, which is fine, but it is a different idea to officially endorsing both |
I don't know what you mean by "degrade". Are you suggesting to change the HTML parser to change |
I see a thumbs up. Changing the HTML parser to change I think we need to decide between |
I've filed https://bugs.webkit.org/show_bug.cgi?id=290625 "MathML unknown elements are not rendered" |
There is no MathML-Core meeting this month in order to discuss this, but for whatever it is worth I personally agree I would prefer to add |
My preference strongly remains to allow href on MathML went to some lengths (including renaming one of its elements) to avoid any name clashes with html (that is it never just relied on namespacing). So to introduce a new |
@davidcarlisle what happens if you use an I'm aware that MathML names carefully avoided name clashes with HTML. But the way the HTML parser works, it's not necessary to avoid name clashes. |
Currently mathml in pdf is largely unspecified (or at least the specification in the ISO PDF 2 spec isn't really usable) we have however made big progress getting at least voice and braille working from embedded MathML and specified at the vendor based pdf association. Currently ISO PDF 2 normatively references mathml3 (so allowing href on everything) not that that actually works in any existing pdf accessibility layer, I'd like to push them to reference mathml-core instead, but I need to offer at least the promise of links working.
Yes sure technically it works, but looking at MathML as a markup language for math, away from its use embedded in html, having an element called
works now in current implementations with
with MathML is the language for marking up mathematics for various digital platforms it has always had a native mechanism for linking, in all versions going back to 1997. To say now it has an True any linking form has to be understood by the sanitizer, but that's one core component that needs to be aware of mathml linking, saying everyone has to use an ugly and backwards incompatible linking mechanism and that no method of linking that was supported in mathml versions 1,2,3 will work going forwards seems a totally inappropriate prioritization of the pros and cons here. |
MathML 3 had a backwards-incompatible change for links by moving from
OK, but that seems like a matter of opinion.
Yes.
I agree it's less clear for humans, though it doesn't seem to be a problem for SVG. The main issue I think is HTML
I can see that it's more disruptive to mint a new element name, but it's also an opportunity to make MathML consistent with HTML and SVG for links. The way I see it, we have two classes of legacy systems to consider: MathML-unaware HTML sanitizers, and MathML renderers. I'd like to have a better understanding of which MathML renderers already support |
Actually, they’re both in the MathML namespace currently, the inner |
@ExE-Boss, no, the https://software.hixie.ch/utilities/js/live-dom-viewer/saved/13623 |
Here's a demo comparing Results:
In terms of compatibility with these browsers today, |
It is in the MathML namespace in this other case from #142 (comment): and from #142 (comment): |
That wasn't backward incompatible change it was an addition. Separately namespaced attributes don't make sense in html rather than the xml parser so xlink:href didn't really make sense in an html world but still..
No, as I say the pdf aspect is mostly that (a) I want to point them at a mathml-core spec that has links and (b) having mathml core a subset of mathml3 so any future working versions are valid according to the existing PDF specs an easier sell. Because they can then specify an "application note" or whatever that says "stick with these forms and it should work", if we add But it's not just PDF. It's a general issue that having no linking form that is valid in both mathml3 and mathml core does make life difficult both in wording the spec and for mathml generators knowing what to generate. For definiteness I'll add an explicit link to SVG https://svgwg.org/svg2-draft/linking.html#Links This is of course the largest hole in my argument, as the general policy for MathML as far as integration into the web platform goes has been "do what svg does" Going forward the difference between I should say that despite being spec editor everything here is personal thoughts and not checked with the working group at all. I suspect my personal preference will always be for |
Yes exactly; those are cases where |
We've already determined in the past, irrc, that most uses of links were on token elements, and that they were possible to rewrite as just moving the |
@bkardell the main problem is that it's a massive breaking change. Currently mathml So this breaks all current mathml generators and all existing mathml documents that have links. It's a very high price to pay. On the web the breakage can be hidden to an extent with javascript polyfills to restore mathml3 compatible behaviour but it is still disruptive, and in other contexts things would be more broken, MathML generators would have no path to generating files that are valid mathml core and MathML3, they will have to choose. |
I'm not saying it is entirely painless, but the plan of only mrow allowing href already means almost no existing mathml 3 valid link will work, right? If the most common existing links are on tokens and we're ready to admit that we can already do without that, and that we won't support href on any of the other elements either... The price seems similar to me, unless you're saying I'm wrong and most links are on mrow and have been for a long time. |
yes probably, but the main problem with If it has to be, it has to be, but I wish it were different. I have a feeling that svg+sanitizer+shadow-root arguments will win out in the end, and as I said above, having links of any sort is far better than not having links, but I still then have to work out how to write the spec to say "sorry we broke all your documents" sound like a positive thing. |
I think you need to distinguish levels of pain. With current browsers, when you have |
Yeah, I mean - I get it, but the future (at least I hope) is longer than the past & you should get the correct rendering. The fact that you don't is a bug we could probably prioritize. Anyway, I guess we can continue to see what people think, I'd hate to make mrow the thing and then have people using mrow in weird places just to use its linking ability bc it's the most 'div-like' thing we have, so making it into a link might shortcut other possible futures. Anyway, we should probably talk about this at working group soon, and maybe arrange for some of us to attend the WHATNOT meeting. |
Rereading here, and something ocurred to me in Brian's comment on the fall back for unknown elements. I'm surprised no one has yet flagged that point in full generality. In MathML Core unknown elements fall back to There could be some creative exploits lurking in that. Fishing for an example, the following is clickable in Firefox today: <math>
<link rel="stylesheet" href="javascript:alert('hi');">
<mi>Test</mi>
</math> codepen: https://codepen.io/dginev/pen/YPzBoNL Maybe that could be solved with a simple spec tweak mentioning that attributes are ignored when falling back, unsure. Thought I should mention it now that I noticed it. |
It falls back to displaying as an |
Maybe the following set of measures is the proper transition?
This would push the responsibility of securing the links to how the |
I've filed https://bugzilla.mozilla.org/show_bug.cgi?id=1958853 |
I heard back from Davide Cervone, one of the developers of MathJax. Once we come up with a plan, they are willing to support it. That includes allowing Hopefully others can chime in with what apps break because of the introduction of the potential introduction of |
https://mathml-refresh.github.io/mathml/#attributes-shared-by-all-mathml-elements says:
This in Gecko has implications and behaves the same way as
<a>
or<area>
.Two things:
Is this feature used / desired / worth it? Links are complex.
If it is, should it really match
:visited
? I think in WebKit it does not, if I'm reading the code correctly.The text was updated successfully, but these errors were encountered: