-
Notifications
You must be signed in to change notification settings - Fork 141
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
USWDS-Site - Alert: Update ARIA role guidance #1770
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ert-aria-update
…ert-aria-update
mejiaj
approved these changes
Sep 23, 2022
bonnieAcameron
approved these changes
Sep 23, 2022
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.
Checked for: clarity, typos, links
thisisdano
approved these changes
Sep 26, 2022
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.
Excellent summary and documentation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Updated accessibility documentation for the alert component to give clearer instructions for adding the appropriate ARIA role.
Related issue
Closes uswds/uswds#3832
Preview link
Preview link: Alert component page
Problem statement
It is important that users are informed of the attributes the alert component needs to make it accessible. However, our current documentation provides information on only some of the available roles and does not give a clear indication of exactly how and where these attributes should be used.
Solution
ARIA provides several
role
attributes that can be added to the alert component to make content more readily available to users of assistive technologies. Each role generates a different behavior and should be chosen based on the urgency and importance of the message.aria-live="assertive"
andaria-atomic="true"
W3C Alert rolearia-live="polite"
andaria-atomic="true"
status rolearia-live
oraria-atomic
values. However, it does make the component appear in the landmarks menu, which can make finding that content easier. This role does require the addition ofaria-labelledby
oraria-label
. Region roleThe proposed solution in this PR creates a table that shows a list of available ARIA roles, use cases for each, and examples chosen from our component variants.
Note: I added the
region
role because it gives the option to add the alert as a page landmark so that users can more easily find it via rotor, etc. It is debatable to me if our alerts should be included as landmarks — the site alert component is a clearer candidate for a landmark role — but I included the information here because it might be useful in certain cases. If we decide the alert should be a landmark by default, we can change the wrappingdiv
in this component to asection
, which is automatically added to the landmarks menu.Note: I removed recommendations for
alertdialog
because the specs indicate that using this role should also involve adding a behavior that moves and traps user focus on thealertdialog
element. Because this did not fit the pattern of the existing alert component, I removed it from the list of recommended roles.Possible next steps:
If we move forward with these examples and recommendations, we should consider adding these roles to the component code. It also might be worth considering converting the outer
<div>
to be a<section>
instead so that it is automatically included in page landmarks androle="region"
would no longer be needed.Testing and review
Before opening this PR, make sure you’ve done whichever of these applies to you:
git pull origin [base branch]
to pull in the most recent updates from your base and check for merge conflicts. (Often, the base branch isdevelop
).npm test
and confirm that all tests pass.