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

Support for SVG implicit role #181

Closed
PaulSearcy opened this issue Jun 2, 2021 · 3 comments · Fixed by #338 · May be fixed by #548
Closed

Support for SVG implicit role #181

PaulSearcy opened this issue Jun 2, 2021 · 3 comments · Fixed by #338 · May be fixed by #548

Comments

@PaulSearcy
Copy link

Coming from a downstream package (testing-library) to make a request to add the implicit role, graphics-document, for svgs.

https://www.w3.org/TR/html-aria/#docconformance

Just a little thing, not a big deal. I'm also going to take a look into the code here to see if it's feasible for me to make a PR!

@jessebeach
Copy link
Member

@PaulSearcy I'm not opposed at all. You'll want to introduce a new directory -- svg -- into the src/etc/roles directory for these roles: https://github.com/A11yance/aria-query/tree/main/src/etc/roles

You can add an else if here:

} else if (name.indexOf('doc-') === 0) {
to parse the graphics- roles into their own directory.

Run this script to parse the JSON file that holds all the role definitions to create the etc directory output:

node ./scripts/breakUpAriaJSON.js

You'll end up hand-writing a lot of information into https://github.com/A11yance/aria-query/blob/main/scripts/roles.json, then running that script to create the src files. I'm happy to review an in-progress PR to let you know if you're headed in the right direction.

@raszi
Copy link

raszi commented Mar 18, 2022

It would be great if you could add this. W3C was added to the ARIA semantics in February 2021:

w3c/html-aria@4f24665

@jlp-craigmorten
Copy link
Contributor

jlp-craigmorten commented Mar 31, 2024

As raised by testing-library/dom-testing-library#1295, unfortunately neither #338 nor #444 fully resolved the OP.

Although these changes added the graphics roles to aria-query, the implicit role of graphics-document was not associated to the HTML <svg> element via the relatedConcepts (or any other property) meaning the likes of @testing-library/dom are unable to derive the implicit role for <svg> elements.


There is a larger can of worms that is supporting the full set of implicit roles for SVG elements as set out by https://www.w3.org/TR/svg-aam-1.0/#mapping_role_table, but that firmly feels like a separate issue that needs some thought given the number of outstanding issues and WIP status of the SVG-AAM specification.

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