hypothesis / support-legacy

a place for tracking support-related work and projects
3 stars 0 forks source link

Annotating text containing MathJax breaks MathJax rendering in Chrome #148

Open sean-fitzpatrick opened 4 years ago

sean-fitzpatrick commented 4 years ago

I was going to comment on #96 but I think this is a different issue. One of my students annotated a sentence containing some math (rendered in MathJax), visible here.

This seems to display OK in Firefox, but in Chrome, the MathJax breaks, as shown in the attached screenshot. (After several refreshes it rendered OK, but not initially.)

hypothesis-error

sean-fitzpatrick commented 4 years ago

I am seeing this on Chrome, in Ubuntu 20.04.

robertknight commented 4 years ago

MathJax has different renderers it can use and I think what may be happening here is that a different renderer is used by default in Firefox compared with Chrome. From a quick test in Safari and Firefox, it seems that only the HTML-CSS math renderer is supported by Hypothesis's current highlighting method. Hypothesis currently wraps each text string with an element to produce accessible highlights and that breaks the display in certain contexts. What we probably need to do in this context is wrap the entire equation with something that draws the highlight.

sean-fitzpatrick commented 4 years ago

I asked MathJax (Davide) about this this summer, as far as the general issue of highlighting math. The HTML-CSS renderer is older, and I'm not sure it's supported in MathJax 3. (PreTeXt hasn't yet migrated to MathJax 3 so our books are still on 2.7.) Common HTML is the default renderer. Most students reading a book don't even know that they can change MathJax settings, so I don't think there's much to be gained from support for HTML-CSS going forward.