-
Notifications
You must be signed in to change notification settings - Fork 2
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 Copied from JAWS 2024's Math Viewer with MathCAT Will Not Auto Convert Into Math Objects in Microsoft Word 365 #4
Comments
I was able to reconstruct the issue. I used Freedom Scientific MathML Example page as my reference MathML code. |
I'm wondering if this issue should be sent to both Freedom Scientific and to Microsoft?
I wonder if @NSoiffer has an informed opinion to guide what we should do here? |
Via pasting in the two mathML examples above, I can confirm that the same behavior is happening on Microsoft® Word for Mac, Version 16.87 (24071426), License: Microsoft 365 Subscription. |
I personally like the idea of sending to both. I think we should approach it from the perspective that other tools like equatio, mathpx etc may also operate similarly where they are only copying a portion of the mathml. (I haven't tested those however, just giving as theoretical examples.) (Also I tried to do this with VO- know its outside the scope of this group, but I couldn't find a way to copy MathML with VO as you can with JAWS/NVDA). |
I too think it should go to both. We can confirm that the Freedom pages with MathML work properly with NVDA, right? |
Sorry for the slow response -- just catching up from a long vacation... FYI: in a web environment, "math" is a known tag and doesn't require a namespace element. Same for "svg". HTML5 is not XML and so it ignores namespaces. The reason the copy/paste works from NVDA is because MathCAT puts the MathML out onto the clipboard using multiple "flavors". One of the flavors is Unicode, but the key for Word is that another flavor that is used is "MathML Presentation". There is also the more generic "MathML" flavor. MathCAT puts both MathML flavors out because an application might only look for one of them. Word sees the MathML flavor and then knows that the clipboard contains MathML. Otherwise, it thinks you want to paste the clipboard contents as text. So the key is to get JAWS to add the flavor when it puts things on the clipboard. From the NVDA code:
When you do a copy, the code is
If the application doesn't know about MathML flavors, the last line serves as a text fallback. On the Mac, an analogous thing needs to be done, but the details differ. I haven't coded this for the Mac, so I don't know the details other than that the MathML spec says to use Bottom line: the solution is not about namespaces -- it is to set up the clipboard format properly. |
It's always amazing how much Neil knows and how much I don't know that I don't know!
Some questions that are all basically "Should not request Microsoft investigate changing the behavior of Word?":
The main risk I see is that the user doesn't want a MathML snippet converted into a math object. However, there are already many use cases where the user needs to use the "Paste as text" feature to avoid having it inserted as an object, formatted, etc. Are there other risks/reasons not to? |
I just tried using VS Code to write an expression and then copy it to Word. The expression seems tocopy correctly. In VS Code, I then created a more complicated expression using the backslash codes and copied it into a empty Word expression and it worked perfectly. Very interesting! |
I found an online clipboard-inspect tool that displays all of the different "flavors"/types of content available in the currently copied item. It's at: https://evercoder.github.io/clipboard-inspector/ |
This is very interesting! I was in VS Code and created an expression. I pasted it into word equation editor and all was well. I used ctrl+= to build it up and copied it to the clipboard. I pasted it into the inspector and it gave me the plain text and the html option. I tried putting it bac in linear with shift+ctrl+= and copied it again. I went to the inspector and copied it out. From what I can tell, it round trips between Word and VS code with one exception. So it seems that √ is aplain text character. I suppose that is just the unicode value. The point is that VS code is simple to write in and if it round trips properly, then we may have a workflow that many people would want to use. While doing this, I crashed MathCAT as I have done before. I filed that issue in the MathCAT issue tracker. |
To recognize plain text as MathML, Word requires the xmlns='http://www.w3.org/1998/Math/MathML' attribute on the < math> element |
To copy MathML from the SVG MathJax DOM (in https://murrayiii.github.io/UnicodeMathML/playground/), I wrote a JavaScript function: function getMathJaxMathMlNode() { Then in my output.addEventListener('keydown', function (e) {...}, I included
This works with desktop Word |
Response from eDAD:
|
Another way to copy MathML into Word from a web page is to ensure that native MathML rendering is active, i.e., that MathJax is not active. You can compare the two using https://murrayiii.github.io/UnicodeMathML/playground/. The Settings menu lets you enable/disable MathJax rendering. The playground web page does copy MathJax MathML as well using the JavaScript code above. |
eDAD tracking ticket for this issue is Accessibility 228596
Description:
Math copied from the Math Viewer in JAWS will not automatically convert into a math object in Microsoft Word 365. Instead, the result is that the MathML for the expression pastes in as plain text. It can be observed that the MathML copied to the clipboard lacks an appropriate
xmlns
attribute on the<math>
element.Steps to Reproduce:
xmlns='http://www.w3.org/1998/Math/MathML'
attribute on the<math>
element.Expected Behavior:
When pasted into Microsoft Word, the MathML should convert into a Microsoft Math Object for the original expression that can be edited using the Equation Editor.
Observed Behavior:
xmlns='http://www.w3.org/1998/Math/MathML'
attribute on the<math>
element.xmlns='http://www.w3.org/1998/Math/MathML'
attribute on the<math>
element before it will recognize the pasted content as MathML.Version Information:
-- OS Name: Microsoft Windows 11 Home
-- Version: 10.0.22631 Build 22631
-- Locale: United States
-- Microsoft 365 Apps for enterprise
-- Microsoft® Word for Microsoft 365 MSO (Version 2406 Build 16.0.17726.20078) 64-bit
-- JAWS Professional Version 2024.2406.121 with MathCAT enabled.
Example Video and Sample Web Page with MathML content:
A link to a short example video demonstrating the issue and a link to the web page used to demonstrate the issue are available below:
Attachments:
Additional Context:
The
xmlns='http://www.w3.org/1998/Math/MathML'
attribute on the<math>
element is optional for MathML contained in an HTML5 document. When MathCAT in NVDA copies math to the clipboard, it appears to ensure that the<math>
element contains the correctxmlns
attribute regardless of if the original<math>
element had one or not.Here is the MathML that was generated when copied using the JAWS Math Viewer with MathCAT enabled:
Note that if the above MathML is copied and then pasted into Microsoft Word, it becomes plain text of the MathML code:
Here is the MathML that was generated from the same expression when copied using MathCAT in NVDA:
Note that if it is copied and then pasted into Microsoft Word it becomes a Microsoft Word Math Object:
The text was updated successfully, but these errors were encountered: