`svg` element role is not consistently supported
Per svg-aam spec, svg elements should have a role="graphics-document"
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
<circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" />
</svg>
is treated differently by browsers:
- Chrome exposes it as role="image"
- Firefox exposes it as role="graphics-document"
- Safari exposes it as generic
Opening a WPT.
Check out the other open SVG issues in this repo, as well as existing tests in both the graphics-aam (and/or graphics-aria?) and svg-aam dirs of WPT.
@cookiecrook's related comment in this svg-aam WPT PR may also help: https://github.com/web-platform-tests/wpt/pull/43196#issuecomment-1818273739.
Thank you @cookiecrook and @rahimabdi.
I believe I've reviewed the items you called out, but I wasn't able to find a WPT test that explicitly shows the role exposed by the browsers (I see only labels). Just to be clear, I'm not referring to verifying an expected result, rather only display the role exposed by the browser.
I was working on an ACT Rules accessibility support note, where consistency among browsers isn't just about aligning with expected results (of course in that case it will be perfect), but it's also about whether browsers behave consistently regardless of specs. Even if no spec is defined, browsers may still be consistent in their behavior, without causing issues for AT users. Conversely, a lack of clarity in specs can lead to differing interpretations, different implementations, and probably accessibility issues depending on the technology used.
For these reasons, in this context where browsers are handling differently the role of SVG elements, maybe might be valuable to have a WPT test that simply demonstrates how browsers expose SVG elements without defining an expected result.
If what I'm saying makes any sense, and you believe it's worth without wasting anyone time, I’d be happy to open a tentative PR with an expected role=SPEC_AMBIGUOUS_LOG_VALUE so that, as ACT group, we have something to reference at this point in time.
I've added our internal tests to the WPT repo in a tentative file, highlighting some inconsistencies with SVG elements.
I also haven't set any expectations. While the specs require all SVGs to be treated equally as graphics-document role, I believe there should be (and likely already is) some heuristic to communicate SVGs based on their intended purpose for users.
WPT testcases results:
| Browser | Testcase | Result |
|---|---|---|
| Chrome | svg | image |
| svg[text] | SvgRoot | |
| svg[symbol] | image | |
| Safari | svg | generic |
| svg[text] | generic | |
| svg[symbol] | generic | |
| Firefox | svg | graphics-document |
| svg[text] | graphics-document | |
| svg[symbol] | graphics-document |