-
Notifications
You must be signed in to change notification settings - Fork 313
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
base: master
Are you sure you want to change the base?
fix(notification): add aria label and description #3145
Conversation
✅ Deploy Preview for carbon-components-angular ready!
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`; |
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.
aria-describedby
attribute usually references an ID not text.
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.
Changed it to the text Notification-ID
@HostBinding("attr.id") notificationID = `notification-${ActionableNotification.notificationCount}`; | ||
@HostBinding("attr.aria-label") notificationLabel = `Notification`; | ||
@HostBinding("attr.aria-describedby") notificationDescription = `Notification-${ActionableNotification.notificationCount++}`; |
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.
@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>
closes: #3144
Added
aria-label
andaria-describedby
to notification element