-
Notifications
You must be signed in to change notification settings - Fork 12
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
va-checkbox | Add description id to aria-describedby #817
Conversation
const ariaDescribedbyIds = [ | ||
messageAriaDescribedby ? 'input-message' : '', | ||
error ? 'checkbox-error-message' : '', | ||
hasDescription ? 'description' : '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would there ever be a scenario when we wouldn't want the description content associated with aria-describedby?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if no description is provided? We don't want to add IDs if they don't exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see what you're saying... Monday was really cray-cray for me. I can't think of any scenario like that. If it ever came up, we could modify the code to accommodate the need.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chromatic
https://56080-checkbox-description--60f9b557105290003b387cd5.chromatic.com
Description
See #56080
Our Supplemental Claim form has a large amount of legal text (8 paragraphs plus a bullet list) which would not work because the
message-aria-describedby
only accepts strings. So we moved the wall of content inside the description slot, but the screen reader still won't read out the content, so this PR adds adescription
ID to the input'saria-describedby
inside the shadow DOM. It was tested and the screen reader does read out the slotted content (see screenshot)Additionally, the
error-message
ID on the span was changed tocheckbox-error-message
so that the USWDS and original checkbox code better matches. This doesn't look like it will make any tests in vets-website fail because React-Testing Library doesn't support shadow DOM and appears to only check the outererror
attribute, and looking through Cypress E2E tests reveals label checks more than anything else.Testing done
Updated tests to check
aria-describedby
IDsScreenshots
Acceptance criteria
Definition of done