-
Notifications
You must be signed in to change notification settings - Fork 795
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
Add exception for ARIA role="text" #1597
Comments
This exception would be very useful. Please add this asap :) |
Thanks for bringing this to our attention. I've started internal discussions about this and we'll see what it would take to implement. |
Wonderful thank you @straker |
tl;dr; I propose we create a new rule for After doing further investigation I believe we can support First, we should only allow However, this does not stop someone from wrapping an anchor element with an element with <!-- no longer announces as link, just text -->
<span role="text"><a href="/site.html">Click here</a></span> There was talk about UAs ignoring Adding the exception about interactive children takes it outside the scope of how we normally handle allowed aria roles, so we would probably have to create a new rule where we add the check we need. {
"id": "text-role",
"selector": "span, div",
"tags": ["cat.aria", "best-practice"],
"metadata": {
"description": "Ensures role=text is used correctly",
"help": "role=text should only be used on span and div elements with no interactive children"
},
"all": ["no-interactive-children"],
"any": [],
"none": []
} |
Sounds good @straker I can think of one other use case for role text in addition to allowing this on div and span elements, that is to also allow this on paragraph elements as that's their native role (as long as they don't have nested interactive elements)? Such as:
I assume that in addition to checking for interactive elements that you can't check if the descendants of the element contain elements with semantics e.g. headings |
@straker would adding this exception also stop the following error as well? GoogleChrome/lighthouse#9337 |
@greenc05 So I tested the provided HTML using the latest axe v3.3.0 and it didn't give a violation for the link not having a discernible name. The presence of the role should only fail the |
Thanks @straker maybe Lighthouse uses a different version of axe, I will ask them... |
@straker any idea if or when this might be worked on please? |
Thank you @straker |
Would love to see this make its way in. Right now I have to choose between losing 9 points in the audit or giving my non-sighted users a sub-optimal experience (my primary page header reads "heading level 1 2 items" instead of just "heading level 1" without role="text"). |
Alright, just a heads up for everyone. We have this planned for the 4.1.0 release. I'm going to start working on this so should be able to have it into develop within the next couple of weeks. Thank you for your patience. |
We didn't quite have enough time to get this rule into the 4.1.0 release, but we were finally able to work on #601 and now have a PR for this rule. |
We finished this and it will be part of the 4.2 release. |
Thank you so much @straker What a start to the new year! |
Update, for future reference. Safari is pulling support for role="text". Here is the issue for it: Talked this over with @dbjorge and @straker. We're going to keep this in axe-core for the time being as there really is no better solution to accomplish what it is doing. |
Invalid ARIA
role="text"
can be used to stop 'text splitting' in VoiceOver iOS https://axesslab.com/text-splitting/ This improves the user experience and does not negatively affect accessibility.Please add an exception, so that the presence of ARIA
role="text"
does not cause the following failure: '[role] values are not valid - ARIA roles must have valid values in order to perform their intended accessibility functions.'The text was updated successfully, but these errors were encountered: