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

MathML Pasted from Various Sources Inconsistently Converts to Microsoft Math Objects in Word #30

Open
brichwin opened this issue Sep 23, 2024 · 1 comment

Comments

@brichwin
Copy link
Collaborator

brichwin commented Sep 23, 2024

eDAD tracking ticket for this issue is Accessibility 230603

Consolidated Issue

This issue consolidates the following issues:

Description

Pasting MathML into Word does not consistently result in a Microsoft Math Object; instead, the raw MathML code is sometimes displayed in the document. This inconsistency seems to depend on both the clipboard format type(s) of the clipboard content and whether or not the <math> tag includes the MathML namespace.

The MathML only becomes a Microsoft Math Object when both of the following are true:

  1. The clipboard contains just the text/plain format of MathML code
  2. The <math> tag includes the MathML namespace (xmlns="http://www.w3.org/1998/Math/MathML").

Otherwise, the result is visible MathML code in the document. For example, if the clipboard contains both the text/plain and text/html clipboard format types the MathML code is pasted in as formatted text.

Expected Behavior

When MathML is pasted into a Word Document, it is desirable to have it automatically converted into a built-up Microsoft Math Object regardless of the format types available on the clipboard and regardless of if/how the MathML is namespaced. Then if the user meant to keep the raw MathML code, the Paste Options Menu could be used to have it pasted in as another option (keep text only, merge formatting, keep source formatting, etc.).

Reasoning for Ignoring the xmlsns Attribute

Tools like MathJax, MathCAT in NVDA, and the JAWS Math Viewer allow users to copy math expressions as MathML but they do not always supply an xmlns attribute nor do they ensure the xmlns attribute value that they sometimes supply is correct.

MathML used in HTML5 does not have to declare a namespace as the HTML parser has in-built knowledge of the HTML, SVG and MathML namespaces. While the xmlns attribute may be used on the math element, it will be ignored by the HTML parser.[1]. Since web user agents ignore the xmlns attribute on math elements and web pages are the most prolific source of digital content, then it is quite reasonable to expect that users will be frequently copying MathML from sources that are either not namespaced or have incorrect xmlns values.

[1] Retrieved from: 2.1.2 MathML and Namespaces - Mathematical Markup Language (MathML) Version 4.0 https://www.w3.org/TR/mathml4/#interf_namespace on September 23, 2024 on September 23, 2024.

Steps to reproduce

MathML Copied Using MathJax (lacks "proper" xmlns value for MathML and clipboard includes text/html data)

  1. Visit the page The Lorentz Transformations
  2. Explore the page to find some math. For example, the first expression after the heading "The Light Cone".
  3. Invoke the MathJax menu, then Show math as, then MathML code. You can also choose Original MathML code.
  4. A new window opens displaying the MathML. Copy the content of this window to the clipboard.
  5. Switch to Word and paste the math. It is not converted into an Office Math expression.
  6. Switch to Notepad and paste the clipboard into a new document. Prepend http: to the value at the beginning of the xmls attribute on the first line. So <math xmlns="//www.w3.org/1998/Math/MathML becomes <math xmlns="http://www.w3.org/1998/Math/MathML"
  7. Copy the text to the clipboard. Switch to the Word document and paste the content of the clipboard. The math is detected and converted to Office Math.

MathML Copied Using JAWS's Math Viewer (lacks the xmlns attribute)

  1. Open Microsoft Word 365 (Desktop version) on Windows 11.
  2. Create a new [blank] document.
  3. Launch JAWS
  4. Use the Early Adopter Program dialog to ensure that MathCAT is enabled.
    • Dialog is available from "Options" > "Early Adopter Program..."
    • Restart JAWS if necessary
  5. Visit a web page that contains math expressions encoded as MathML
  6. Navigate to a math expression
  7. Press "Enter" to bring up the "Math Viewer"
  8. Press "Ctrl+C" to copy the math expression
    • You should hear "Copied selection to clipboard"
  9. Switch back to the blank Microsoft Word document
  10. Press "Ctrl+V" to paste the math expression into the Word document
  11. Note that instead of a Microsoft Math Object that represents the expression copied in step 8, that the raw MathML for the expression was pasted in as plain text.
  12. Also note that the MathML that was pasted in does not have a xmlns='http://www.w3.org/1998/Math/MathML' attribute on the <math> element.
@brichwin brichwin changed the title Ensure MathML Pasted from Various Sources Converts to Microsoft Math Objects in Word MathML Pasted from Various Sources Inconsistently Converts to Microsoft Math Objects in Word Sep 23, 2024
@ways2read
Copy link
Member

Response from eDAD:

We are not able to find the UI of the issue mentioned. Please provide us a video attachment for this issue.

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

No branches or pull requests

2 participants