`<mspace linebreak="newline" />` 不适用于资源管理器辅助功能

`<mspace linebreak="newline" />` not working with explorer accessibility

激活辅助功能浏览器后,MathML 换行符 <mspace linebreak="newline" /> 将不起作用。

重现步骤:

  1. 打开https://jsbin.com/sajujukiwe/1/edit?html,js,output
  2. 通过使可访问性 explorer 属性 到 falsetrue.
  3. 检查数学表达式的显示方式

explorer 设置为 false 时会有一个换行符,这是我想要的,但我也想要辅助功能。

我在这里找到了解决方法,https://github.com/mathjax/MathJax/issues/2496#issuecomment-675626155

The issue turns out to be in the a11y extension that handles the collapsible elements in the math. When the collapsing is in the content for the top-level element, the MathML tree is not rebuilt quite right, and that disables the line-breaking. I have made a fix in the a11y repository, and it will be included in the next release of v2. In the meantime, you can use

  <script type="text/x-mathjax-config">
  (function () {
    var V = MathJax.version.split(/\./);
    if (V[0] === "2" && (parseInt(V[1]) < 7 || (V[1] === "7" && parseInt(V[2]) <= 8))) {
      MathJax.Hub.Register.StartupHook("Collapsible Ready", function () {
        var Collapsible = MathJax.Extension.collapsible;
        Collapsible._MakeAction = Collapsible.MakeAction;
        Collapsible.MakeAction = function (collapse, mml) {
          if (mml.type !== 'math') return this._MakeAction(collapse, mml);
          var mrow = mml.data[0]; mml.data = mrow.data; mrow.data = [];
          var maction = this._MakeAction(collapse, mml);
          mrow.data = mml.data; mml.data = [mrow];
          return maction;
        };
      });
    }
  })();
  </script>

just before the script that loads MathJax.js itself in order to fix the issue until the new version is available. This checks the version number, so the patch will only affect version 2.7.8 and below.