I design and build higher education courses on Canvas that often include worked math examples. Faculty are fond of writing these equations out as text instead of using LaTeX or something similar.
For example:
As an all-equity firm, the WACC is equal to its cost of equity (ru). Therefore we can say:
WACC = (ru + market risk premium)2
= (5% + 6%)2
= 0.0121%
These courses need to be accessible to screenreaders and the screenreaders should read the equations in natural language wherever possible.
Due to the limitations of the platform, I can only apply CSS by using the style
attribute.
In the past, I used span
elements with the role
of img
to apply an aria-label
that describes the equation in natural language, and I hid the original text from the screen reader using another span
that has aria-hidden
set to true
.
For example:
<p>
As an all-equity firm, the firm’s WACC is equal to its cost of equity (r<sub>u</sub>). Therefore we can say:
</p>
<p>
<span role="img" aria-label="Weighted average cost of capital = open parenthesis, r u + market risk premium, close parenthesis, squared">
<span aria-hidden="true">WACC = (r<sub>u</sub> + market risk premium)<sup>2</sup></span>
</span>
</p>
<p style="margin-left: 50px;">
<span role="img" aria-label="Open parenthesis, 5% plus 6%, close parenthesis, squared">
<span aria-hidden="true">= (5% + 6%)<sup>2</sup></span>
</span>
</p>
<p style="margin-left: 50px;">= 0.0121%</p>
The issue here is then that the screenreader is identifying the text as an image, which it is not, but I have yet to find another role
that all screenreaders pick up and will read.
A second solution was to simiarly hide the original text from the screenreader using aria-hidden
, and then create a 0.1px by 0.1px span
that contained the natural language version (which most users won't see), but this feels like a bad solution.
Example:
<p>
<span aria-hidden="true">WACC = (r<sub>u</sub> + market risk premium)<sup>2</sup></span>
<span style="position: absolute; right: auto; top: auto; width: 0.1px; height: 0.1px; overflow: hidden;">Weighted average cost of capital = open parenthesis, r u + market risk premium, close parenthesis, squared</span>
</p>
What is the best practice for provilde a "text alternative" to existing text that assistive devices will read instead of the text that most users will see?