-
Notifications
You must be signed in to change notification settings - Fork 402
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
ARIA role
attribute should be allowed on SVG elements
#769
Comments
Which element of the SVG elements should the role attribute be allowed? Every element? |
By SVG 2, it's allowed on any renderable element.[1] The HTML validator has backported this support to 1.1, so seems like we should do the same. [1] https://www.w3.org/TR/SVG2/render.html#TermRenderableElement |
I see now where allowing role comes from, since it's not defined in SVG 1.1. In HTML 5.1 it says under the SVG section:
So this issue is actually bigger than just role. |
So, should we allow role and aria-* for all SVG elements? Here is a list of all aria-* attributes copied from http://www.w3.org/MarkUp/DTD/aria-attributes-1.mod aria-busy |
We should probably follow what SVG2 says, since that's what they're emulating. I checked the w3c validator and it doesn't truly allow any attribute on any element. It looks like they follow the guidance of only allowing on renderable content, which makes sense since the user won't be interacting with non-renderable content (it throws errors on title, desc, style, etc.). The list of attributes looks correct, but I haven't tried to match up each against the list in SVG2: https://www.w3.org/TR/SVG2/struct.html#WAIARIA-definitions |
aria-current and aria-details (and several attributes) are added in the SVG2 list mentioned above. Should we allow some new attributes only in SVG content documents, while disallowing them in HTML and embedded SVG? |
No, we should probably omit from all. They're part of ARIA 1.1, which isn't a REC yet, so always a chance they could be dropped. |
aria-describedat and aria-orientation are in html5-aria-30.rnc, but not in ARIA 1.0. Is this a mistake? |
aria-describedat is dead and buried now, but it was prematurely referenced from 3.0.1. Our lesson in not taking anyone's word on what will make a final specification. I think there's a warning generated somewhere else because it's technically "deprecated".[1] @rdeltour ? (It's removed from 3.1.) aria-orientation is in 1.0.[2] It can remain. [1] http://www.idpf.org/epub/301/spec/epub-contentdocs.html#sec-xhtml-aria-describedat |
OK. We now know which ARIA attribute should be allowed. It remains to determine which SVG element can have such ARIA attributes. Some renderable elements of SVG2, audio, canvas, iframe, mesh, unknown, and video, do not exist in SVG 1.1. So, we have
I will create a schema fix and submit a pull request. |
Yes, that was one of the stranger spec requirements I've seen. Thanks. |
I agree that the role attribute should be allowed only for renderable elements. But how about other aria-* attributes? The last para of 5.13.3. State and property attributes (all aria- attributes)
|
Right, but that's followed by:
It looks like w3c did a thorough job of determining which attributes are meaningful on which elements for the validator. The commit is here: We're heading towards the permissive mess they've cleaned up. Are we still expecting to align with those schemas? It would be better if we were only ever adjusting for epub peculiarities rather than having to patch core issues in parallel. |
I can agree to mimick what Validator.Nu is doing. But I do not want to copy their schemas without incorporating their Java validation codes, which are intended to complement their schemas. In other words, either whole-sale reengineering based on Validator.Nu or parallel patching is good to me. |
During review of PR #780 which adds aria support for SVG elements, I tried to add a unit test with the above example by @rdeltour / @clapierre:
While the patch by @murata0204 works well for the
Is this attribute supposed to throw an error or is this reported by mistake/bug? |
The focusable attribute is only part of SVG 1.2 Tiny, I believe. In SVG 2 they recommend setting tabindex=0. The tabindex attribute is allowed on HTML5 elements per that weird SVG implementation section.[1] I haven't looked at the EPUB schema in any detail, but I imagine all those exclusions/additions need to be factored in, not just the ARIA attributes. [1] https://www.w3.org/TR/html51/semantics-embedded-content.html#svg |
Thanks Matt! So I'll leave it out from the test. |
From @clapierre:
The text was updated successfully, but these errors were encountered: