Optimization: don't process hidden MathML
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.9k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Background
MathJax makes math accessible by including MathML that is invisible/hidden. Many sites preprocess a page and do the same (or very nearly the same) thing for their pages to make the math on those pages accessible.
In some cases, software may come along and inject MathJax into such a page. An example where this could happen is an EPUB reader that uses MathJax to make the MathML in an EPUB book display. In this case, MathJax will process the hidden math and add a layer of spans around the original MathML. At least with NVDA, the math remains accessible and the display is not affected (i.e., this does not appear to be a bug based on very limited testing).
Suggestion
There is a computational trade off that needs to be checked, but if determining that something isn't visible is quick, then time can be saved by avoiding computing the display for hidden math. It would also minimize the chances that MathJax interferes with the accessibility of the math.
If it is computationally slow to know if something is visible or if it is "hard" to do this programatically, a convention using some sort of flag (class name, clip value, ...) could be specified and authors could generate that.
CSS Sample
Here is a CSS sample of how some MathML might be hidden using a class:
.MathMLNoDisplay {
clip: rect(1px, 1px, 1px, 1px);
clip-path: polygon(0px 0px, 0px 0px, 0px 0px, 0px 0px);
position: absolute !important;
white-space: nowrap;
height: 1px;
width: 1px;
overflow: hidden;
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no implementation files or tests. Start by evaluating whether hidden MathML can be detected efficiently in the EPUB-reader scenario, using the provided CSS sample as a case to investigate; done should mean hidden math is skipped without changing visible output or accessibility.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, html, javascript
- Domain
- accessibility, frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100