-
Notifications
You must be signed in to change notification settings - Fork 15
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
fix ID and aria control string issue #3014
Conversation
@@ -49,7 +49,7 @@ export const AccordionLabResults: React.FC<AccordionLabResultsProps> = ({ | |||
), | |||
content: content, | |||
expanded: collapsedByDefault, | |||
id: title, | |||
id: title.replaceAll(/[^a-zA-Z0-9-_:.]/g, "-"), |
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.
we have a helper function for this called toKebabCase
- could you use that instead?
@@ -41,7 +41,7 @@ const EcrSummary: React.FC<EcrSummaryProps> = ({ | |||
conditionSummary.map((condition) => { | |||
return { | |||
title: condition.title, | |||
id: condition.title.replaceAll(" ", "-"), | |||
id: condition.title.replaceAll(/[^a-zA-Z0-9-_:.]/g, "-"), |
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.
same here
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.
thanks!
@gordonfarrell were you able to re-run the axe test on this to make sure it's appeased? |
Yep! |
PULL REQUEST
Summary
For lab accordions we were setting the ID to whatever the title was, and the associated aria-controls value to whatever the id was. Because the title was any old string it could contain characters like spaces, commas, ampersand, whatever, that are not valid values for an ID and thus also invalid for aria-controls. Changed how we set the value of the ids to replace any invalid characters with a -
Related Issue
Fixes #2965
Acceptance Criteria
Axe accessibility scans return 0 critical or high severity issues with lab report accordions opened or closed.
Additional Information
Anything else the review team should know?
Checklist