w3c / w3c/mathml-core

Horizontal alignment of MathML elements with horizontal overflow

Open
#190 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
56
Forks
20
PR merge metrics
No merged PRs in 30d

Description

cc @bfgeek @distler

Some MathML elements perform horizontal centering (namely math@display=block, mfrac, munder, mover, munderover).

In #75 we decided to support the width property, allowing the content box to be wider/narrower than the math content box. Current spec essentially says that the math content for the elements mentioned above is centered within the specified width. However, in the case where the width is narrower than the math content and some overflow happens, negative offsets show up and it is no longer possible to scroll to the leftmost part of the math content.

This was reported in Chromium #1416539 for math@display=block:

<math display="block"
      style="width: 2em; overflow-y: hidden; overflow-x: scroll">
  <mn>123456789.987654321</mn>
</math>

and is fixed in Chrome Canary by clamping the offset of the math content to 0. This can be easily be done for other elements, but we will likely lose the fact that the middle of the children are aligned:

<math>
  <mfrac style="width: 2em; overflow-y: hidden; overflow-x: scroll">
    <mn>123456789</mn>
    <mn>123456789.987654321</mn>
  </mfrac>
</math>

<math>
  <munder style="width: 2em; overflow-y: hidden; overflow-x: scroll">
    <mn>123456789.987654321</mn>
    <mn>123456789</mn>
  </munder>
</math>

<math>
  <mover style="width: 2em; overflow-y: hidden; overflow-x: scroll">
    <mn>123456789.987654321</mn>
    <mn>123456789</mn>
  </mover>
</math>

<math>
  <munderover style="width: 2em; overflow-y: hidden; overflow-x: scroll">
    <mn>123456789.987654321</mn>
    <mn>123456789</mn>
    <mn>987654321</mn>
  </munderover>
</math>

A slightly more complex fix is to shift all the children by the opposite of the smallest offset (negative, so largest in absolute value) so that the offset of the widest child is set to 0 and its respective alignment with the other children is preserved.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the horizontal alignment behavior for math@display=block, mfrac, munder, mover, and munderover, then read the decisions in #75 and the Chromium #1416539 report. Compare the supplied overflow examples and determine how to preserve child alignment while making the widest content reachable by horizontal scrolling.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
frontend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.