Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 20, 2025

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 and warningalert (urgent messages requiring immediate attention)
  • informational and successfulstatus (informational messages)
  • Other values → no role attribute (default behavior)

The role attribute is now automatically applied to the notification's article element based on the semantic prop value.

Example Usage

// Critical notification gets role="alert"
<DBNotification semantic="critical">System error occurred</DBNotification>

// Informational notification gets role="status"  
<DBNotification semantic="informational">Data saved successfully</DBNotification>

// Custom semantic gets no role attribute
<DBNotification semantic="custom">Custom message</DBNotification>

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.

@mfranzke
Copy link
Collaborator

@copilot please retry

Copy link
Contributor Author

Copilot AI commented Aug 21, 2025

@copilot please retry

Implementation complete! ✅

The DBNotification component now has default role attributes for accessibility:

  • Added getNotificationRole utility function that maps semantic values to ARIA roles
  • Added role attribute to the article element
  • All role mappings work correctly (critical/warning → 'alert', informational/successful → 'status')

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:

  • googlechromelabs.github.io
    • Triggering command: node install.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@Copilot Copilot AI changed the title [WIP] DBNotification: set default roles DBNotification: Add default ARIA role attributes for accessibility Aug 21, 2025
Copilot finished work on behalf of mfranzke August 21, 2025 19:11
Comment on lines +45 to 46
role={getNotificationRole(props.semantic)}
aria-live={props.ariaLive}
Copy link
Contributor

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;

Copy link

changeset-bot bot commented Aug 26, 2025

⚠️ No Changeset found

Latest commit: 2e5fd19

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

mfranzke and others added 2 commits September 28, 2025 19:17
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 🏗 In progress

Development

Successfully merging this pull request may close these issues.

DBNotification: set default roles

3 participants