-
Notifications
You must be signed in to change notification settings - Fork 13
DBNotification: Add default ARIA role attributes for accessibility #4815
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: mfranzke <[email protected]>
@copilot please retry |
Implementation complete! ✅ The DBNotification component now has default role attributes for accessibility:
Changes are minimal and focused - only 20 lines total across 2 files. Commit: 6271418 Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
role={getNotificationRole(props.semantic)} | ||
aria-live={props.ariaLive} |
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.
You could set role="alert" and aria-live="off", which is contradictory (https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Guides/Live_regions).
You could derive a default aria-live from the role only when ariaLive isn’t provided (alert --> assertive, status -->polite) to avoid invalid combinations and maximize a11y compatibility.
something like
const role = getNotificationRole(props.semantic);
const derivedLive =
role === 'alert' ? 'assertive' :
role === 'status' ? 'polite' :
undefined;
|
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Enhances the DBNotification component with appropriate ARIA role attributes based on semantic values to improve accessibility for assistive technologies.
Changes Made
Added a utility function
getNotificationRole
that maps semantic notification types to appropriate ARIA roles:critical
andwarning
→alert
(urgent messages requiring immediate attention)informational
andsuccessful
→status
(informational messages)The role attribute is now automatically applied to the notification's article element based on the
semantic
prop value.Example Usage
This implementation follows ARIA best practices and enhances screen reader support without breaking existing functionality.
Fixes #4206.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.