-
Notifications
You must be signed in to change notification settings - Fork 15
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
Should all MathML elements really be potential hyperlinks / match :visited? #142
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 like @davidcarlisle 's first suggestion: Simply allowing linking from This would minimize the pain of a transition period since as generators & browsers evolve their support, the worst breakage would be whether or not an href was clickable. That would be easy to live with; the breakage in other cases (esp. when the html parser starts getting creative) could be pretty bad.
|
This sounds great to me if it's possible, probably! Best way to align things in my mind. I guess the biggest question is is it possible? Would all of the vendors definitely be open to it (hesitation to break/change content by some is part of what led to dropping it from L1)? |
I'd almost be more in favor of figuring out if we can change the
HTML parser to allow HTML |<a>| inside MathML somehow than to
continue to support this.
My concern here is that the transition period will be quite painful.
The html parser of an unpatched browser that sees an a in an unexpected
place (except within a token?), will convert the tree into something
rather unexpected, and probably very un-math-like.
|
I tried to find any existence proof of this. https://github.com/cure53/DOMPurify and https://github.com/rhukster/dom-sanitizer allow MathML elements but seem to remove For @annevk 's idea to change the parser, I think that may be worse from an XSS risk perspective. There are various sanitizer bypasses involving SVG or MathML. Inserting an HTML element but still being in foreign content (to be able to insert MathML elements) could break expectations. I think we shouldn't go this path. Adding an |
fwiw, I didn't realize that @brucemiller maybe, but we have already defined unknown elements should render as mrows
(https://w3c.github.io/mathml-core/#new-display-math-value) so is it really very different than just allowing href on an mrow? Also, no content today would have that, so it's not like existing content is going to break this way. I suppose the one thing that won't happen is that existing mrow links won't Just Work |
href on So I suspect anyone coming to this "from mathml" is going to prefer that option. That said, it seems that people coming to this from general web platform standpoint have a preference for re-purposing so I'd prefer href on mrow, but I'd be happy to get the functionality with any syntax that works. |
Right, so considering only MathML Core, if we add some parser fixup to make sure If we introduce a new Of course the concern here is that not all existing implementations or documents align with MathML Core. I believe having |
No but it doesn't need a parser fixup, it just needs to be defined in MathML-Core equivalently... and I think mainly beyond that it's just a matter of making it work like the rest of the spec says already, right? https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=12512
|
Right, no parser changes necessary with I think the main benefits of
The benefits of
|
I think adding
which currently displays correctly (ie losing this:
is a bit of a pain except (a) it's already lost for content designed to work in mathml-core level 1 and (b) it's hardly the only feature of mathml 3 that doesn't survive and will need a polyfil or document changes. |
FWIW, I think keeping |
The link is the most important element in the web, it would be really nice if there were a commonly recognizable way to link across HTML, SVG and MathML imo. I don't think it is the end of the world if we choose to make mrow the one linkable element instead, but it feels like an unfortunate missed opportunity to me to make MathML not the weird outlier - especially given the points above. |
Curious dilemma, I wasn't expecting we would have two viable paths forward. Based on the Math WG discussion yesterday (March 28), we were unanimous that from a MathML perspective the better solution is in Are there any trade-offs to keep in mind? Is it easier to interoperate with other mechanisms, such as |
I think this is not the case; if you swap an existing
Yes, HTML |
I am one of those that was in the Math WG meeting that agrees getting linking is better than not having any linking. But for backwards compatibility, I strongly prefer leaving it on To copy @bkardell's list, this time for
So the only browser where a link on MathML is used in applications beyond the browsers. I doubt many of those applications do anything with links, but many of them aren't happy when they encounter tags that aren't part of MathML 3. As a test, here are the applications I tried using
MathPlayer and MathCAT are apps/addons to the NVDA screen reader for reading math. MathPlayer has been EOL'd and can't be changed. MathCAT is the replacement I'm writing, so it can be changed. JAWS has started to use MathCAT as its math speech tool, but currently choosing between legacy JAWS math and MathCAT is an option. If supporting legacy documents and applications is important, there is a compelling case to allow If that's not an option, then adding |
I am one of those that was in the Math WG meeting that agrees getting linking is better than not having any linking. But for backwards compatibility, I strongly prefer leaving it on To copy @bkardell's list, this time for
So the only browser where a link on MathML is used in applications beyond the browsers. I doubt many of those applications do anything with links, but many of them aren't happy when they encounter tags that aren't part of MathML 3. As a test, here are the applications I tried using
MathPlayer and MathCAT are apps/addons to the NVDA screen reader for reading math. MathPlayer has been EOL'd and can't be changed. MathCAT is the replacement I'm writing, so it can be changed. JAWS has started to use MathCAT as its math speech tool, but currently choosing between legacy JAWS math and MathCAT is an option. If supporting legacy documents and applications is important, there is a compelling case to allow If that's not an option, then adding |
It probably should (like HTML span), as the use cases are similar. This may be a compelling reason to introduce Btw this is also why we can't assume And for generator tools which don't know in advance when shadows would be desirable, the default choice would be to generate both. Which is fine. |
It's not clear to me the current safelist for |
The a11y tools related one is potentially the strongest argument in my mind. It really sounds like people seem to be converging on Most use of href in existing content is not on mrow, but tokens. So if we choose
Only by some very lose definition of "works" though, it's not actually that much more than a (the point of my list was just to illustrate parse/render concerns were largely unfounded). Currently where it is supported it still it doesn't support any of the important attributes or match link styles appropriately, or have similar default tabindexes, etc. We still have to actually do all of those things. I guess my personal preference, if we have to admit all of the above would be to add support in a way that makes MathML less weird and unique. We have stated that we want to get to a future in which new things 'lift all boats' - when we add ideas like shadow doms and popovers it's not an impossible discussion about if/how this relates to MathML (or SVG) because we're talking about largely "one platform"... It seems to me inevitable (given what we've already dealt with) that weird, unique legacy things have future impacts. Again, admitting all of the things above, it seems to me the future is longer than the past. That said, the a11y tools is very strong. I'm not sure how difficult or impractical it is to change MathType/Mathematica, but I also assume that this is again going to be the case if/when we eventually add any new element, too? @NSoiffer do you know? |
So the only browser where a link on mrow does not work now is Chrome.
Only by some very lose definition of "works" though, it's not actually
that much more than a (the point of my list was just to illustrate
parse/render concerns were largely unfounded). Currently where it is
supported it still it doesn't support any of the important attributes
<https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attributes>
or match link styles appropriately, or have similar default tabindexes,
etc. We still have to actually do all of those things.
I'm confused; I would have thought that that "a" within math
disappearing completely in Safari was exactly a well-founded concern.
It at least means that with the a-enhanced route, some user agents will
display new material wrong; you would have to serve different formats to
different browsers and/or use polyfills. That's not to say tha this is
the single most important decision point (we've dealt with worse), but
it shouldn't be dismissed.
In contrast, the mrow-enhanced route tends to fail more gracefully: new
content will still look like math, but may or may not support any or all
href-related attributes, depending on the browser. That's basically
the status-quo, but with a path forward.
[Noting that there are several layers of work/don't work being discussed
here: all href attributes supported; just basic href attributes
supported; no href supported versus doesn't even look like math]
I'm sympathetic to your goal of making MathML less "odd", but it's hard
for me to judge how significant the difference between adopting an "a"
versus mrow with href would be. I'm perhaps too cynical (w/reason) to
think that MathML will suddenly be BFF, but you may be correct that
adopting a would smooth future evolutions?
|
I said "largely" :). It is limited to 1 bug in 1 engine (note it is a bug that needs fixing no matter what we decide here). There is currently no MathML content uses But again, the a11y tools one is a strong argument. |
While searching GitHub for "mrow href" I found that it's a known XSS exploit, which indicates that it is being (or at least has been) used to bypass HTML sanitization: |
Just for the record, https://w3c.github.io/mathml-core/#security-considerations has some description of known sec issues with MathML 3 including the case of maction + href (see also https://bugzilla.mozilla.org/show_bug.cgi?id=1392258 ). If we add back href into MathML Core, we shouldn't forget to update this section accordingly. |
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 |
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: