Skip to content

fix(notification): add aria label and description #3145

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

r1shabhsharma
Copy link

closes: #3144

Added aria-label and aria-describedby to notification element

Screenshot 2025-05-20 at 6 27 59 PM

@r1shabhsharma r1shabhsharma requested a review from a team as a code owner May 20, 2025 12:58
Copy link

netlify bot commented May 20, 2025

Deploy Preview for carbon-components-angular ready!

Name Link
🔨 Latest commit 6d1909a
🔍 Latest deploy log https://app.netlify.com/projects/carbon-components-angular/deploys/682f73e515bab30008e2152e
😎 Deploy Preview https://deploy-preview-3145--carbon-components-angular.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@@ -83,6 +83,8 @@ export class ActionableNotification extends BaseNotification {
}

@HostBinding("attr.id") notificationID = `notification-${ActionableNotification.notificationCount++}`;
@HostBinding("attr.aria-label") notificationLabel = `Notification`;
@HostBinding("attr.aria-describedby") notificationDescription = `${this.notificationObj.type} notification`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aria-describedby attribute usually references an ID not text.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it to the text Notification-ID

@r1shabhsharma r1shabhsharma requested a review from Akshat55 May 22, 2025 18:58
Comment on lines +85 to +87
@HostBinding("attr.id") notificationID = `notification-${ActionableNotification.notificationCount}`;
@HostBinding("attr.aria-label") notificationLabel = `Notification`;
@HostBinding("attr.aria-describedby") notificationDescription = `Notification-${ActionableNotification.notificationCount++}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@HostBinding("attr.id") notificationID = `notification-${ActionableNotification.notificationCount}`;
@HostBinding("attr.aria-label") notificationLabel = `Notification`;
@HostBinding("attr.aria-describedby") notificationDescription = `Notification-${ActionableNotification.notificationCount++}`;
notificationID = `notification-${ActionableNotification.notificationCount++}`;
@HostBinding("attr.aria-labelledby") labelledby= `Notification-${this.notificationID}`; // May need to use a getter, double check.

Update the code to use aria-labelledBy, you can remove aria-label. The ID should be assigned to the following element (title):

<div *ngIf="!notificationObj.template" cdsActionableTitle [innerHTML]="notificationObj.title"></div>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Accesibility]: Notifications are missing label and description fields
3 participants