generated from cloud-gov/.github
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Upgrade success Alerts to role="alert" so they're read consistently #573
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
Test: | ||
When Alert shows on the page, | ||
SR reads the message. | ||
*/ | ||
|
||
'use client'; | ||
|
||
import { Alert } from '@/components/uswds/Alert'; | ||
import { useState } from 'react'; | ||
|
||
export default function AlertPage() { | ||
const [alertShown, setAlertShown] = useState(false); | ||
|
||
return ( | ||
<> | ||
<button onClick={() => setAlertShown(true)}>show alert</button> | ||
<button onClick={() => setAlertShown(false)}>hide alert</button> | ||
{alertShown && <Alert type="error">this is an alert!</Alert>} | ||
</> | ||
); | ||
} |
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
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
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
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
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.
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.
Eleni! Thank you very much for pulling all this together. (And for all the research in #531!)
I’m curious if this change might potentially be trading one set of usability issues for another? At least, I was under the impression that
role="alert"
/aria-live="assertive"
were to be reserved for urgent messages that need a timely response, as they’ll interrupt any other message currently being read to the user by their AT. I’m worried that could be differently disorienting than what we’ve already got.Dunno; what do you think?
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.
That's a good point and I agree that this seems odd. In our use cases, success messages were not being read when they were given a role of
status
, which to me seemed even more disorienting for AT users. But they were read consistently when upgraded to role ofalert
.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'm up for fiddling with the
/prototype/alert
page more to see if we can still getstatus
alerts to work more consistently. Adding and removing the status alert from the DOM gave no SR announcements. I tried keeping a status alert in the DOM while updating the text inside of it, but the SR would only read it the first time it changed.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 Eleni! I was finally able to access
/prototype/alert
(#575), and can confirm messages aren’t being read consistently in Safari/VO.Out of curiosity, would it be possible to have an empty ARIA live region in the document by default, and inject our messages into that container? I wonder if that’d fix the timing issue. (I think we might have discussed this briefly on a call, and specifically that this wasn’t possible; apologies if I’m asking a pre-answered question.)
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 considered that, but ultimately concluded that it would be a workaround for alerts not acting properly, which they should be. I'd like for future devs to be able to use the
Alert
component wherever and have it work as expected. I'm happy to talk through it more (maybe at the next a11y jam?).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.
That sounds great, let’s do it!