-
Notifications
You must be signed in to change notification settings - Fork 331
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
Radios that conditionally reveal content use aria-expanded
which is not a valid aria-attribute for those roles
#979
Comments
To fix "Elements must only use allowed ARIA attributes" #979 Attempted solution: - Remove aria-expanded - Follow "Optionally, each element that serves as a container for panel content has role region and aria-labelledby with a value that refers to the button that controls display of the panel" from https://www.w3.org/TR/wai-aria-practices/#accordion
Results of my partial investigation: Error: "Elements must only use allowed ARIA attributes"Underlying issue
Alternative approachTested W3C's guidance about alternative way of revealing content: "Optionally, each element that serves as a container for panel content has role region and aria-labelledby with a value that refers to the button that controls display of the panel" This made the experience worse for NVDA users as the "collapsed/expanded" was no longer announced on the radio Notes:
NVDA / Firefox (worse experience) Current example reads out: My code Jaws 16 / IE11 (no change) Current example reads out: My code |
I have reviewed this issue, and some related alongside Hanna's findings and done some more investigation and chatted with the accessibility community and the team. Our current implementation is invalid of the ARIA specification
This is why aXe is throwing an error. Incorrect ARIA attribute usage is not always a Web Content Accessibility Guidelines (WCAG) failure.While investigating if this usage is against WCAG (4.1.1 parsing: https://www.w3.org/TR/WCAG21/#parsing), I spoke to the accessibility community and Richard (an accessibility specialist at GDS) gave the following response: 'I use the definition literally when checking this “elements have complete start and end tags, elements are nested according to their specifications, elements do not contain duplicate attributes, and any IDs are unique, except where the specifications allow these features.”' This means that using ARIA in places not allowed in the specification is not a failure. Only some assistive technologies announce something useful
Google Sheets original testing Which supports other issues we have raised that show there are issues with VoiceOver and JAWs.
So a large chunk of the assistive technologies we test in support this incorrect aria usage. Assistive technologies have no incentive to support this patternWe could consider asking the vendors for JAWs and VoiceOver to fix their behaviour to be consistent with NVDA. I think that because the aria specification does not allow for this usage these vendors will not prioritise any features. We could also argue that the fact that there is support in the first place is a coincidence. The teams maintaining this code will not be checking this use case, this means in the future it could be dropped or mistakenly broken for our users. Updating the ARIA specification to include radios and checkboxesWe could consider contacting the ARIA working group and proposing to update the specification so it'll allow for our use case. I think for this to be considered we'd need strong evidence that this pattern is used across the industry, not just government. I don't think this would be resolved in a short time period. Next steps to considerI think based on what we know so far we should explore options that avoid invalid use of ARIA Remove invalid ARIA attributesSome in the wider accessibility community have suggested that this pattern may not be inaccessible even without the invalid ARIA attributes.
However, we have one piece of feedback that suggests that extra affordance is important.
This also is reinforced by the details and accordion component, which have similar user needs, using Reconsider the design pattern entirelyWe could consider moving away from this pattern and trying something different that avoids the technical issues. However it's a well used pattern and has been through lots of user research sessions by various teams. Manage focus when conditional reveals openOne common way of indicating that new content is available to interact with is to manage the users focus. For example with a sidebar menu, you may move the user's focus over to the menu. This will not work for a conditional reveal pattern using radios as it will disrupt being able to cycle through the radio group using up and down. Using aria-live to announce state changesWe could consider using an aria-live announcer pattern, to announce You can the result of trying this in further comments in this thread. Using visually hidden text to indicate state changesWe could consider adding visually hidden text that serves a similar purpose to the You can the result of trying this in further comments in this thread. |
I have created two spikes to test: I've recorded the conclusions here: https://docs.google.com/spreadsheets/d/1i1yFXuv-mvvDpi36gd9ZFjRiaUM7m-1WppIZYnYbUts/edit?usp=sharing The summary is that:
Perhaps a more descriptive message could be given to elements instead of 'Expanded', for example 'Interacting with this input opens a new section', we could consider I'll discuss this all with the team. |
The Design System team met and discussed these findings. This pattern has been through a lot of user research by different service teams and we have not had any feedback to suggest that this is not working for real users of assistive technologies. We will ask the community for more research with real users of assistive technologies to understand if there are any barriers. We know that users of the screen reader JAWs and VoiceOver on Mac (Checkboxes only) are not helped by This means we will:
|
Aria-expanded on checkboxes is already in the draft for ARIA 1.2. And @36degrees has started a conversation at W3C to do likewise for radio buttons - and I have just added my support for that proposal as well to hopefully help move it along a bit. If all goes well we'll see it added in before release. However, it will take a year or two for all mainstream assistive devices to catch up, even though some of them already do it. So, for the time being, I would suggest using a very brief text for screen readers of "Reveals content", added either using aria-describedby on the radio button, or as screen reader text appended, with a comma, in the radio button's element. Just two words like that should be enough - you don't want to make it too verbose or, as mentioned above, it will annoy the users! |
In March 2021, we spoke to a Lead Auditor at the Digital Accessibility Centre who works alongside screen reader testers and users with disabilities. They audit a lot of government services, especially HMRC services. As such, they're pretty familiar with the current approach to conditional reveals. They mentioned that they’d known about the invalid use of aria-expanded for a while, but not really flagged it as it’s normally read by screen readers (at least the versions of JAWS and NVDA they test with, would have to check Voiceover). |
We’re leaving this issue open whilst we wait for the proposal to ARIA to be resolved. It’s part of a future ARIA 1.3 milestone so it may take some time before being looked at. For now, we’ll keep using the If ARIA reject our proposal, we’ll stop using |
There's [a known issue](alphagov/govuk-frontend#979) with radio buttons that conditionally-reveal content, due to the `aria-expanded` attribute being "invalid" on the element. I've decided to ignore that specific rule on that page here, as we don't want to build our own custom conditional text box here, and the issue is still under review. This also fixes an issue with a duplicate `hint` `id` on the page.
There's [a known issue](alphagov/govuk-frontend#979) with radio buttons that conditionally-reveal content, due to the `aria-expanded` attribute being "invalid" on the element. I've decided to ignore that specific rule on that page here, as we don't want to build our own custom conditional text box here, and the issue is still under review. This also fixes an issue with a duplicate `hint` `id` on the page.
Update: the ARIA proposal milestone has been moved to ARIA 1.4: w3c/aria#1404 (comment) |
To confirm: Using As this issue is now only relevant to radio buttons, I'm going to rename it to reflect that change. |
aria-expanded
which is not a valid aria-attribute for those roles
Radios that conditionally reveal content use aria-expanded which is not a valid aria-attribute for those roles Accessibility: Elements must only use supported ARIA attributes Reference: alphagov/govuk-frontend#979 Update accessibility step to ingore the in-accessible element instead of ignoring the accessible rule
Radios that conditionally reveal content use aria-expanded which is not a valid aria-attribute for those roles Accessibility: Elements must only use supported ARIA attributes Reference: alphagov/govuk-frontend#979 Update accessibility step to ingore the in-accessible element instead of ignoring the accessible rule
Adds a new feature spec which covers the basic form filler journey. It only contains one question, which is answered without triggering any validation, and the form is submitted without opting for an email confirmation. There's also a tweak to our use of the Axe clean accessibility checks, which was flagging up our use of `aria-expanded="false"`. It looks like this should be passing, and the Axe rule hasn't been changed yet to reflect this. As a result, we've ignored any triggering of this rule on radio buttons. See alphagov/govuk-frontend#979 for more details
Originally raised by @injms on alphagov/govuk-design-system
Elements must only use allowed ARIA attributes
To solve this violation, you need to:
Fix the following:
I think the expected behaviour would be to have no critical issues flagged by aXe - unless this is a false alarm or is found not to have any impact after testing in the empathy lab.
@36degrees:
edit: Split #1591 into a separate issue
The text was updated successfully, but these errors were encountered: