w3c / mathml

MathML4 editors draft
https://w3c.github.io/mathml/
Other
63 stars 19 forks source link

Intent and style (mathcolor, CSS, others?) #441

Closed dginev closed 6 minutes ago

dginev commented 1 year ago

Recent trends in pedagogical enhancements over mathematical notation use a variety of styling primitives (traditionally realized on the web via CSS, or MathML attributes such as mathcolor, mathvariant, mathbackground , mathsize).

A recent medium-agnostic collection of resources in this direction is the awesome mathematical notation design showcase.

Here is a motivating screenshot from the first example paper in the collection: Math Augmentation: How Authors Enhance the Readability of Formulas using Novel Visual Design Practices.

The screenshot contains a display equation, paragraph and diagram, all targeted at sighted readers, which use different colors for each separate conceptual piece in each modality. For example, the "incoming light" concept is highlighted in the text in purple, as is its L_i term in the display equation, as well as the corresponding arrows in the hand-painted diagram.

The question for this issue is - how do such techniques fit with the intent paradigm, if at all, so that AT users can also benefit from the additional visual information.

To start with the simplest possible example, consider a red variable x, with two possible MathML expressions:

<mi mathcolor="red">x</mi>
<mi style="color: red;">x</mi>

Will AT be able to pick up the color information by default? Should it? Alternatively, should an author be able to make it explicit that such information is important to also convey to AT users?

The first temptation is to reach for intent="red-x", or intent="_(_red,$x), but one could of course also consider providing the information in the accessible description via intent="x:red-color-variable".

Another example would be the use of an <mrow style="border:solid;">...</mrow> to draw a rectangle border around a term, presumably as a means of emphasis or to designate a particular notation. In the case where this has a named notation, intent can be used as designed.

In the case of styling emphasis (as in "boxed"), we are probably closer to intent=_boxed($this) or intent=$this:has-rectangular-frame, but I am quite unsure at the moment. In addition, if a larger sub-expression had a dedicated color (typically contained within an mrow) it is conceivable that AT may want to mark the "start" and "end" of certain colored zones.

I think the group hasn't considered the relationship between the intent mechanism and the styling information in the presentation tree yet, so I am opening an issue to start a discussion.

davidcarlisle commented 1 year ago

I guess if all you have is mathcolor="red" then intent="x:red-color-variable" is fine but in your example paper where the colours have known semantics then probably using properties such as:incoming-light might be appropriate? We don't have so many examples of how : should get used in practice....

dginev commented 1 year ago

In the call today (27.04) we seemed to be generally in favor of a small spec clarification mentioning that styling information is generally not conveyed through AT. And that in cases where styling is used to convey important information, an author will need to record that separately via Intent.

It may be helpful to include a small example, e.g. marking a variable name as intent="red-x" or assigning a property such as :incoming-light, in place of a specific color style.

Yaffle commented 1 year ago

Can <math><msub id="light"><mi>L</mi><mn>0</mn></msub></math> ... <span aria-describedby="light">the light towards...</span> help in this use case? HTML also supports title attribute, so another variant is <span title="L_0(x, w_0)">...</span>

dginev commented 1 day ago

If we make a clear decision that aria-description is a supported attribute within the intent paradigm, I could add an example showcasing that (e.g. for colored variable types).

I think that may be pending at the moment? (#493)

davidcarlisle commented 1 day ago

I had to check but currently...

MathML-core doesn't mention ARIA at all, and MathML full just says (in section C.3)

The placing of ARIA labels and aria-labeledby is not appropriate in MathML because this will override braille generation.

So this doesn't explictly mention aria-description but isn't exactly encouraging.

Somewhat in contradiction the draft schema allows (just)


# sample set, like data- may need preprocessing to allow more
MathMLARIAattributes =
  attribute aria-label {text}?,
  attribute aria-describedby {text}?,
  attribute aria-details {text}?

but I think that comes from before we added intent and said more about ARIA in the spec, it seems inconsistent now.

So...

It would be good if the example just used intent (and could go straight in the draft) but if you find yourself needing to use ARIA in addition probably best to add it to this issue so we can discuss if ARIA is really needed for that (and if so what the spec should say to enable that)