-
Notifications
You must be signed in to change notification settings - Fork 8
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
Should SVG with no accessible children have role=img? #12
Comments
On the face of it this seems like a good idea to me.
|
Also w3c/html-aam#290 |
I'm working on Chromium's SVG-AAM implementation. I think we should make this mapping change. |
Currently an SVG root element is treated as a document rather than an image. Given that most SVGs on the web are for icons rather than complex documents, this exposure might not make sense. There is an open issue in the SVG-AAM spec's github suggesting that if an SVG has no accessible children, it should be exposed as an image rather than as a document. See w3c/svg-aam#12 AX-Relnotes: Expose SVGs with no accessible children as an image rather than a document. Bug: 231654 Change-Id: I1b05d713813ecc9546cd26b602b8f6526b41e861 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3195891 Reviewed-by: Aaron Leventhal <[email protected]> Reviewed-by: Jochen Eisinger <[email protected]> Reviewed-by: Nektarios Paisios <[email protected]> Commit-Queue: Aaron Leventhal <[email protected]> Cr-Commit-Position: refs/heads/main@{#930670}
As the (unexpected-to-me) notification above indicates: The implementation in Chromium to expose SVG with no accessible children as role=img is done. |
As I understand it from my own testing, Chromium (at least on Windows) currently exposes all svgs as role image. I see problems with this if the svg mutates to contain accessible children (and there's no reason that can't happen). Consider this:
The svg initially contains no accessible children, but after a second, it mutates to contain an accessible child. If we have different role mappings for svg here, the role has to change. This is a challenge for some platforms at least, particularly with roles as different as image and document. To deal with that, should the browser recreate the whole subtree? This would require the browser to check the parent every time an accessible is added/removed from an svg subtree to see whether it needs to be recreated. There's probably no perf issue there, but it will definitely require special case code with regard to tree management, so we need to be sure this is really what we want. |
Currently an SVG root element is treated as a document rather than an image. Given that most SVGs on the web are for icons rather than complex documents, this exposure might not make sense. There is an open issue in the SVG-AAM spec's github suggesting that if an SVG has no accessible children, it should be exposed as an image rather than as a document. See w3c/svg-aam#12 AX-Relnotes: Expose SVGs with no accessible children as an image rather than a document. Bug: 231654 Change-Id: I1b05d713813ecc9546cd26b602b8f6526b41e861 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3195891 Reviewed-by: Aaron Leventhal <[email protected]> Reviewed-by: Jochen Eisinger <[email protected]> Reviewed-by: Nektarios Paisios <[email protected]> Commit-Queue: Aaron Leventhal <[email protected]> Cr-Commit-Position: refs/heads/main@{#930670} NOKEYCHECK=True GitOrigin-RevId: 2b46499fc2ba3e80f2b1f1e3f7fef64fa6be3c03
See discussion: w3c/html-aam#43
(This came up on Twitter and I couldn't find the issue because it was on HTML-AAM instead of SVG-AAM.)
Summary of issue:
Currently, the SVG element is mapped to the
graphics-document
ARIA role.Most uses of inline SVG on the web are for simple icons, where the "document" nature of the SVG tree isn't relevant — there are no interactive or named child nodes. It may be better for end users if these simple SVGs are just treated as regular images.
Next steps:
I'd like some feedback from implementers if they see any problem with having an element's role depend on it's child tree. If it seems feasible to include that check, then I agree that using the
img
role for this case, and reserving thegraphics-document
role for cases where there is accessible child content.PS, probably best to keep all the discussion in the same place: on the HTML-AAM issue for now, until a decision is made.
The text was updated successfully, but these errors were encountered: