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

fix: Upgraded Mathjax version from 2.7 to 3.0.1 #32418

Closed
wants to merge 7 commits into from

Conversation

Yagnesh1998
Copy link
Contributor

Description:
fix: Upgraded Mathjax version from 2.7 to 3.0.1

OpenEdx is using Mathjax 2.7 version in the current version which is less accessible this drives us to upgrade it to the new latest version of Mathjax (3.0.1) which is having more support for accessible people.
Example:
Old (2.7): when we tab to the equation, it doesn't speak.
New (3.0.1) when we tab to the equation, it starts to speak the equation nicely.

Testing instructions:

  • Open any course content page where we have an equation on content.
  • Enable accessible mode for the application.
  • Start tabbing and reach the equation, audio is not played for the equation.
  • After the upgrade, it starts to play equations nicely.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jun 12, 2023
@openedx-webhooks
Copy link

openedx-webhooks commented Jun 12, 2023

Thanks for the pull request, @Yagnesh1998! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@mphilbrick211 mphilbrick211 added the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Jun 13, 2023
@e0d
Copy link
Contributor

e0d commented Jun 15, 2023

Updated with a merge commit.

@e0d
Copy link
Contributor

e0d commented Jun 15, 2023

@Yagnesh1998 looks like there are test failures, can you have a look.

@e0d e0d removed the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Jun 15, 2023
@Yagnesh1998
Copy link
Contributor Author

@e0d can u please help what is failure?

@e0d
Copy link
Contributor

e0d commented Jun 19, 2023

You will need to look at the log of the failing unit test and figure out why the change is causing it. You can see the logs by clicking on the details link. I'm going to update the branch, but the failures are almost certainly caused by the upgrade.

@e0d
Copy link
Contributor

e0d commented Jul 10, 2023

@Yagnesh1998 The failures seems to be related to differences in MathJax configuration. See this:

https://github.com/openedx/edx-platform/actions/runs/5501574151/jobs/10025256535?pr=32418#step:7:100

@arbrandes
Copy link
Contributor

This is on my queue to review, but one thing off the bat: MathJax upgrades must not be taken lightly. There is a lot of content across organizations that uses it, and the relevant stakeholders have to be brought into this so they can check for regressions. (There have been issues with MathJax upgrades in the past.)

With that in mind, ideally we'd find a way for content owners to roll this out incrementally. Maybe via course waffle flag to enable MathJax 3?

@mphilbrick211
Copy link

@Yagnesh1998 The failures seems to be related to differences in MathJax configuration. See this:

https://github.com/openedx/edx-platform/actions/runs/5501574151/jobs/10025256535?pr=32418#step:7:100

Hi @Yagnesh1998! Just following up on this :)

@wittjeff
Copy link

wittjeff commented Aug 23, 2023

The current supported version of MathJax is 3.2.2. https://www.mathjax.org/

As noted above, the configuration is different between v2.x and v3.x. The platform currently uses a mix of v.2.x and v3.x (v3.x in Discussions, for example).

There is a known shortcoming with v.3.x related to lack of support for line breaks (or automatic wrapping, or both). mathjax/MathJax#2312
fred-wang/webextension-native-mathml#14
This issue is apparently resolved in v4.0a. https://github.com/mathjax/MathJax-src/releases/tag/4.0.0-alpha.1

The interactivity (particularly accessibility features) of v3 is quite a bit different than v3, so users who rely on accessibility features may consider an automatic upgrade disruptive. More specifically, institutions that host courses that include MathML, and who provide accessibility documentation of their own, may find that their docs are obsolete.

In the last year or so, Firefox and Chrome have added support for native rendering of MathML (though I'm not sure about details re expected formats). If the browser supports minimal rendering of MathML, it's conceivable that different users having more specific accessibility UI preferences might be able to use their preferred solutions through browser extensions instead of integration in the platform. A long-term solution that doesn't involve pushing JS packages for MathML rendering might also save a lot of $ in data traffic.

There's another accessibility solution for MathML, called MathCAT. https://nsoiffer.github.io/MathCAT/
The maintainer is well regarded and the feature list is impressive but I'm not deeply familiar with it and I don't know anyone who uses it.

What I'd like to see in Open edX learning experience MFE and supported xBlocks:
Add a course-level setting (in Studio) for MathML rendering, with 5 or 6 options:

  • None (rely on browser rendering, if confirmed to be adequate)
  • MathJax v2.x (last supported version) -- default value
  • MathJax v3.x (last supported version)
  • MathJax v4.0ax (last preview version)
  • MathCAT (last supported version)
  • possible 6th option: KaTeX (last supported version) https://katex.org/

This way, course authors can confirm layout compatibility with their MathML content (something we can't do in an automated way), and can also also toggle accessibility solutions if a learner has a specific preference.

For the rest of the platform, I think upgrading to MathJax v3.x (last supported) is safe for now.

@wittjeff
Copy link

wittjeff commented Aug 23, 2023

Possibly of interest: Force MathJax/KaTeX/MediaWiki to use native MathML rendering. https://chrome.google.com/webstore/detail/native-mathml/lcadkfljmcmcflpdbfmgcpjlejmpcplg

Related to addition of MathML rendering support in Chrome:
https://famousandfaded.com/deep-cuts/mathml-chrome-cross-platform-support/

I see that for native rendering, Chrome is looking for syntax, so there would be some updating needed in Open edX docs, and also some compatibility checking and/or adjustment with math authoring solutions used in TinyMCE throughout the platform.

Open edX expects authors to use
( equation )
or
[mathjaxinline] equation [/mathjaxinline]

https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/latest/exercises_tools/mathjax.html

MathType authoring plugin for TinyMCE is another possible accessible authoring solution: https://docs.wiris.com/mathtype/en/mathtype-integrations/mathtype-for-html-editors/mathtype-for-tinymce.html

https://www.npmjs.com/package/@wiris/mathtype-tinymce6

Not mentioning edX though: https://www.wiris.com/en/mathtype/mathtype-for-lms/

@wittjeff
Copy link

wittjeff commented Aug 23, 2023

Sample pages for testing rendering: https://developer.mozilla.org/en-US/docs/Web/MathML/Examples

@wittjeff
Copy link

One more thought: I'm told that MathJax isn't working in some countries such as China, due to certain content servers being blocked. If we're going to update configuration, it might be a good time to move the source files to a self-managed server to resolve this issue.

@mphilbrick211
Copy link

Hi @Yagnesh1998! Flagging the above comments for you. Please let us know if you plan to pursue this pull request. Thanks!

@mphilbrick211 mphilbrick211 added the inactive PR author has been unresponsive for several months label Sep 12, 2023
@arbrandes
Copy link
Contributor

Seconding @wittjeff's comment above: I don't think we'll be able to straight-up upgrade Mathjax to v3. At the very least we'll need to retain the current (v2) behavior as a default during a deprecation window, while giving the option to turn on the new one. And in an ideal world we'd give authors the option to pick, as Jeff describes.

@Yagnesh1998
Copy link
Contributor Author

Yagnesh1998 commented Sep 20, 2023

I am very sorry for the very late replay @mphilbrick211 & @wittjeff

@Yagnesh1998
Copy link
Contributor Author

Yagnesh1998 commented Sep 20, 2023

@wittjeff & @arbrandes
I ran into a problem when I made a pull request this time.
Blind people can't see they are only here and they also access the edx-platform. we have installed a screen reader extension in Chrome and we have added some Mathjax equations but there is no support so we have made some changes on the platform side and Version upgraded. We ran this extension again and that time it easily worked all Mathjax functions correctly. we added those Mathjax functions in Studio and checked in LMS on 12/06/2023 so this time we thought this issue of the Mathjax version so I made a pull request. please let me know what I need to do next.
now I can see my commit is conflicts.

@mphilbrick211
Copy link

Hi @wittjeff and @arbrandes - just flagging this for follow-up.

@mphilbrick211 mphilbrick211 removed the inactive PR author has been unresponsive for several months label Oct 24, 2023
@navinkarkera
Copy link
Contributor

I have created a PR: #33555 for the full upgrade. Apologies for missing this PR but it seems to be incomplete, still I should have probably continued the work here instead of starting fresh.
cc: @Yagnesh1998 @arbrandes

@Yagnesh1998 Yagnesh1998 closed this Nov 8, 2023
@openedx-webhooks
Copy link

@Yagnesh1998 Even though your pull request wasn’t merged, please take a moment to answer a two question survey so we can improve your experience in the future.

@Yagnesh1998
Copy link
Contributor Author

@navinkarkera I close this PR and we will continue on #33555

@wittjeff
Copy link

wittjeff commented Nov 8, 2023

More notes just to be thorough:

  • @ormsbee is disinclined to pull MathJax libraries into our codebase and I'm sympathetic to his concerns.
  • If MathJax (or any other option from the suggested options above) doesn't load as expected, we should default to some other option.
  • I note just as a curiosity that as of this date ChatGPT4.0 uses KaTeX to render math output. I don't know if that will be inherited in any of edX.org's chatbot implementations when we eventually upgrade (v3.5T apparently "doesn't do math").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants