add custom ARIA announcement options to Toaster component - #765
Open
wakki0202 wants to merge 4 commits into
Open
add custom ARIA announcement options to Toaster component#765wakki0202 wants to merge 4 commits into
wakki0202 wants to merge 4 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or 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
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.
You can use this as the PR description:
Summary
This change makes
aria-live,aria-atomic, andaria-relevantconfigurable per toast.This allows screen reader announcement behavior to be adjusted based on the type of notification. For example, error messages and other urgent notifications can now be announced with higher priority instead of always using a fixed
politesetting.Background
Previously, announcement behavior was effectively fixed, and in particular
aria-livewas always treated aspolite.While this is reasonable for general notifications, it is not sufficient for cases like error messages or critical alerts where the content should be conveyed more urgently to the user.
From an accessibility perspective, different kinds of toast notifications should be able to control how and when they are announced by assistive technologies.
Changes
aria-liveper toastaria-atomicper toastaria-relevantper toastMotivation
Some notifications, such as error messages, need to be announced with urgency.
With this change, toast notifications can provide more appropriate ARIA semantics depending on their purpose, which improves accessibility and gives consumers more control over screen reader behavior.
Example
For example, informational messages can continue using
polite, while error notifications can useassertiveso they are announced more immediately.If you want, I can also make this shorter and more GitHub-native, or rewrite it in a more formal OSS project style.