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

Update needed for "no corresponding role" description due to mappings of SVG #232

Closed
dd8 opened this issue Jun 10, 2020 · 7 comments
Closed

Comments

@dd8
Copy link

dd8 commented Jun 10, 2020

html-aria says svg has no corresponding role, and the only allowed roles are application, document or img

svg-aam says svg has implicit role graphics-document and any role is allowed
https://www.w3.org/TR/svg-aam-1.0/#roleMappingGeneralRules

Firefox exposes svg in html as role=graphic
Chrome exposes svg in html as role=SVGRoot
Safari doesn't expose svg in html (treats it role=presentation)

This means there's no way to use inline <svg> elements for decorative images because role=presentation isn't allowed. You can see this causing a problem in practice here on www.gov.uk:
validator/validator#981

@scottaohara
Copy link
Member

scottaohara commented Jun 10, 2020

Role=presentation would not consistently work to mark all types of svgs as decorative. Accessible content inside such svgs could still be exposed. The gov.uk site as an example, the within can still be reached with voice over.

If an svg need to be treated as decorative and have no content exposed, it can be set to aria-hidden=true... which, upon further testing would also need to be set for certain child elements of the SVG (such as the <image>).

@dd8
Copy link
Author

dd8 commented Jun 11, 2020

Ok that makes sense disallowing role=presentation due to the inner SVG elements like links.

What about the implicit role for SVG elements? html-aam says no role (which matches Safari, but not Chrome/Firefox), svg-aam says role=graphics-document

@scottaohara
Copy link
Member

HTML AAM presently says it maps to graphics-document role.

ARIA in HTML says "no corresponding role", because "graphics-document" is not presently a valid role for authors to use.

@scottaohara
Copy link
Member

scottaohara commented Jun 11, 2020

actually, strike my earlier statement here. I think this issue could be used as a reminder to revise the description of "no corresponding role" in ARA in HTML to more clearly indicate what was discussed here.

@scottaohara scottaohara reopened this Jun 11, 2020
@scottaohara scottaohara changed the title Spec inconsistency between svg-aam and html-aria Update needed for "no corresponding role" description due to mappings of SVG Jun 11, 2020
@dd8
Copy link
Author

dd8 commented Jun 12, 2020

May also be worth adding a note about using aria-hidden instead of role=presentation on inline SVG.

There are several behaviour differences for SVG referenced by <img src> vs inline <svg> and <svg><image href> that are not very obvious. Some folks will switch from <img src> to inline <svg> to reduce network requests not realising there's an accessibility impact.

@scottaohara
Copy link
Member

Hmm. maybe. though information like that might be a better fit for https://w3c.github.io/using-aria/

@scottaohara
Copy link
Member

closing this as duplicate to 158

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

2 participants