Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

role="math" on images #1562

Open
gregoriopellegrino opened this issue May 22, 2024 · 4 comments
Open

role="math" on images #1562

gregoriopellegrino opened this issue May 22, 2024 · 4 comments

Comments

@gregoriopellegrino
Copy link

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

@mattgarrish
Copy link
Member

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.

@clapierre
Copy link

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" />

@mattgarrish
Copy link
Member

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.

@gregoriopellegrino
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants