Skip to content
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

Horizontal alignment of MathML elements with horizontal overflow #190

Open
fred-wang opened this issue Mar 8, 2023 · 0 comments
Open

Horizontal alignment of MathML elements with horizontal overflow #190

fred-wang opened this issue Mar 8, 2023 · 0 comments

Comments

@fred-wang
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant