Re: mtable positioning in MathML Core

Hi everyone,

I have concocted a somewhat shameful hack that will work successfully in
both today's Firefox and the upcoming Chrome, in the hope that it will
inspire a more CSS-savvy reader to invent the proper solution.

In short:
- for Firefox, keeping the align="baseline 1"  markup continues to work,
all else being equal
- for Chrome, one solution that appears to work is giving the mtable in
question a "display: table-cell;" with "vertical-align: bottom;"
- however, to work in both browsers, we need some CSS hack or another that
hides the "display" change from Firefox, or it breaks the "align"

You can find a minimal demonstration snippet here, which works in both
browsers today:
https://gist.github.com/dginev/dae157e358db31c85489d8e31052affc

Is there / will there be a less hacky way?

Greetings,
Deyan

On Fri, Dec 2, 2022 at 1:44 AM Neil Soiffer <soiffer@alum.mit.edu> wrote:

> Someone who knows CSS better than I might be able to suggest something,
> but I'm dubious. CSS can't even do decimal alignment 8-|.
>
> I think MathML has some very useful alignment features (beside just
> "decimal"), but adding them is I think level 2
> <https://github.com/w3c/mathml-core/issues/44> or (not labeled level 2) this
> issue <https://github.com/w3c/mathml-core/issues/125>. I suspect you'll
> need to rely on a polyfill, but some people have very clever CSS tricks up
> their sleeves.
>
>     Neil
>
>
> On Thu, Dec 1, 2022 at 4:23 PM Miller, Bruce R. (Fed) <
> bruce.miller@nist.gov> wrote:
>
>> Hi Neil;
>> "which specific CSS feature I'm trying to use" is exactly my question:
>> Which feature *should* I use to get the effect of (full) mtable's
>> align="baseline 1"?
>>
>>   Are you suggesting that
>>      align-content: first baseline;
>> is what I'm looking for? It doesn't seem to help in Chrome.
>> All the other tricks I find seem to want me to change the display property
>> of the mtable (from table), which doesn't seem helpful.
>>
>> As for a general polyfill, all I can say so far is that @columnalign
>> wasn't too hard :>
>>
>> Thanks;
>> bruce
>>
>> On 12/1/22 2:48 PM, Neil Soiffer wrote:
>> > According to
>> >
>> https://developer.mozilla.org/en-US/docs/Web/CSS/align-content#browser_compatibility
>> > <
>> https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FCSS%2Falign-content%23browser_compatibility&data=05%7C01%7Cbruce.miller%40nist.gov%7Cae796cc49093442fb20108dad3d523f4%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638055209634388729%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=MbrZx%2B%2BoHNuixcbOuDrLM2aHbkyTpMBA7udpIF%2FxF50%3D&reserved=0>,
>> most CSS alignment is implemented. You didn't mention which specific
>> feature in CSS you are trying to use. I'm dubious that it is "easily" done
>> because usually CSS deals with parent-child relationships. In this case, it
>> is a parent-grandchild relationship.
>> >
>> > The mtable polyfill only handles mlabelledtr and needs to be expanded
>> (I'll add an issue
>> > if there isn't one already). At the time I wrote the polyfill, it
>> wasn't clear whether any
>> > of the MathML mtable attrs would end up in core or not. The polyfill
>> will need to handle
>> > it by doing some measurements and then (likely) use CSS (absolute
>> position) or mpadded to
>> > do the appropriate shift.
>> >
>> >      Neil
>> >
>> >
>> > On Thu, Dec 1, 2022 at 8:17 AM Miller, Bruce R. (Fed) <
>> bruce.miller@nist.gov
>> > <mailto:bruce.miller@nist.gov>> wrote:
>> >
>> >     Hi all;
>> >         I'm wondering what the proper modern CSS method
>> >     is to achieve the equivalent of MathML Full's
>> >         <mtable align="baseline 1" ...
>> >     given that that attribute is not included in Core.
>> >
>> >     That is, to align the table (as a whole) so that
>> >     the baseline (or math axis, or ...) of the 1st row
>> >     lines up with the baseline of its siblings.
>> >
>> >     CSS Box Alignment level 3 looks like it should answer that,
>> >     but I can't quite apply it (or it isn't implemented in Chrome?)
>> >
>> >     Thanks;
>> >     bruce
>> >     --
>> >     bruce.miller@nist.gov <mailto:bruce.miller@nist.gov>
>> >     http://math.nist.gov/~BMiller/ <http://math.nist.gov/~BMiller/>
>> >
>>
>> --
>> bruce.miller@nist.gov
>> http://math.nist.gov/~BMiller/
>>
>>

Received on Tuesday, 6 December 2022 00:46:31 UTC