epubcheck icon indicating copy to clipboard operation
epubcheck copied to clipboard

role="math" on images

Open gregoriopellegrino opened this issue 1 year ago • 4 comments
trafficstars

When following the WAI ARIA 1.2 example for using role="math" on an image element to indicate that it represents a mathematical expression (https://www.w3.org/TR/wai-aria-1.2/#example-8), EPUBCheck reports an ERROR RSC-005 stating that the value of the "role" attribute is invalid.

From the WAI ARIA 1.2 spec:

While it is not ideal to use an image of a mathematical expression, there exists a significant amount of legacy content where images are used to represent mathematical expressions. Authors SHOULD ensure that images of math are labeled by text that describes the mathematical expression as it might be spoken.

However, EPUBCheck doesn't recognize math as a valid value for the role attribute, resulting in a false positive error.

Here you can find a sample EPUB file exhibiting this issue for testing purposes: quadratic-formula.epub.zip

gregoriopellegrino avatar May 22 '24 09:05 gregoriopellegrino

This doesn't look like a problem to fix in epubcheck. You've put the role on an img tag where it isn't valid per the ARIA in HTML specification.

I think you need to take this to the ARIA group to sort out whether it is allowed on images or not and update the ARIA in HTML document accordingly. Validation of roles normally come from the validator.nu code, so that needs updating to fix the issue here, and they don't usually modify their code until the ARIA in HTML document is updated.

mattgarrish avatar May 22 '24 12:05 mattgarrish

Sounds like there are some major confusion using role="math"

Look here https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/math_role they have an example: <img src="pythagorean_theorem.gif" alt="a^{2} + b^{2} = c^{2}" role="math" />

clapierre avatar May 22 '24 16:05 clapierre

Sounds like there are some major confusion using role="math"

The ARIA spec appears to be the source of this markup (see the section on polyfilling the equation). They show an example of transforming math to an image and the markup also shows the role on the img tag.

If I try it out in a browser and check the accessibility tree, the alt text is correctly associated with the role, so I suspect it's the ARIA in HTML doc that is out-of-date. But fixing it and then the validator is usually what's necessary to get a change into epubcheck.

mattgarrish avatar May 22 '24 17:05 mattgarrish

Okay, so I'll open an issue for ARIA-HTML.

gregoriopellegrino avatar May 27 '24 07:05 gregoriopellegrino

This was very recently updated in w3c/html-aria#525 and validator/validator#1773. I'll update the validator.nu schemas to bring the fix to EPUBCheck.

rdeltour avatar Dec 26 '24 16:12 rdeltour