Skip to content

wrong placement of MathML in SVG with Safari #3302

@xworld21

Description

@xworld21

Issue Summary

On Safari, certain MathML-in-SVG is rendered in the top left corner of the image regardless of its intended position. This is definitely a Safari bug (reasonable guess is https://bugs.webkit.org/show_bug.cgi?id=23113), but I am hoping MathJax can include a workaround for the time being.

For instance: resetting the position and will-change CSS properties of <mjx-container> resolves the problem, although it probably messes up the alignment if the MathML is not the only content within <foreignObject>.

Steps to Reproduce:

Add MathML in the scope of a transform. For example:

<svg width="400" heigth="100" viewbox="0 0 400 100">
  <rect x="0" y="0" width="400" height="100" stroke="black" fill="none" />
  <foreignObject transform="matrix(1 0 0 1 300 0)" width="1" height="1" overflow="visible"><math>
      <mi>a</mi>
    </math></foreignObject>
</svg>

renders as
image
instead of
image

Technical details:

  • MathJax Version: 3.2.2
  • Client OS: Mac OS X 14.7
  • Browser: Safari 18.0.1

I am loading MathJax via

<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>

Metadata

Metadata

Assignees

No one assigned

    Labels

    AcceptedIssue has been reproduced by MathJax teamBrowser BugCode ExampleContains an illustrative code example, solution, or work-aroundFixedv4.0

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions