Skip to content
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

fix(notification): update status icon description prop #5266

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ const notificationProps = () => ({
'Icon description (iconDescription)',
'describes the close button'
),
statusIconDescription: text(
'Status icon description (statusIconDescription)',
'describes the status icon'
),
hideCloseButton: boolean('Hide close button (hideCloseButton)', false),
onCloseButtonClick: action('onCloseButtonClick'),
});
Expand Down
24 changes: 18 additions & 6 deletions packages/react/src/components/Notification/Notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,9 @@ NotificationIcon.propTypes = {
export function ToastNotification({
role,
notificationType,
onCloseButtonClick, // eslint-disable-line
iconDescription, // eslint-disable-line
onCloseButtonClick,
iconDescription,
statusIconDescription,
className,
caption,
subtitle,
Expand Down Expand Up @@ -287,7 +288,7 @@ export function ToastNotification({
<NotificationIcon
notificationType={notificationType}
kind={kind}
iconDescription={iconDescription}
iconDescription={statusIconDescription || `${kind} icon`}
/>
<NotificationTextDetails
title={title}
Expand Down Expand Up @@ -359,6 +360,11 @@ ToastNotification.propTypes = {
*/
iconDescription: PropTypes.string.isRequired,

/**
* Provide a description for "status" icon that can be read by screen readers
*/
statusIconDescription: PropTypes.string.isRequired,

/**
* By default, this value is "toast". You can also provide an alternate type
* if it makes sense for the underlying `<NotificationTextDetails>` and `<NotificationButton>`
Expand Down Expand Up @@ -392,8 +398,9 @@ export function InlineNotification({
actions,
role,
notificationType,
onCloseButtonClick, // eslint-disable-line
iconDescription, // eslint-disable-line
onCloseButtonClick,
iconDescription,
statusIconDescription,
className,
subtitle,
title,
Expand Down Expand Up @@ -426,7 +433,7 @@ export function InlineNotification({
<NotificationIcon
notificationType={notificationType}
kind={kind}
iconDescription={iconDescription}
iconDescription={statusIconDescription || `${kind} icon`}
/>
<NotificationTextDetails
title={title}
Expand Down Expand Up @@ -499,6 +506,11 @@ InlineNotification.propTypes = {
*/
iconDescription: PropTypes.string.isRequired,

/**
* Provide a description for "status" icon that can be read by screen readers
*/
statusIconDescription: PropTypes.string.isRequired,

/**
* By default, this value is "inline". You can also provide an alternate type
* if it makes sense for the underlying `<NotificationTextDetails>` and `<NotificationButton>`
Expand Down