Skip to content

Commit

Permalink
fix(StaticNotification): set describedby on action button (#15858)
Browse files Browse the repository at this point in the history
* fix(StaticNotification): set describedby on action button

Signed-off-by: Edward Fink <finken@us.ibm.com>

* fix(StaticNotification): additional story for button only

Signed-off-by: Edward Fink <finken@us.ibm.com>

---------

Signed-off-by: Edward Fink <finken@us.ibm.com>
Co-authored-by: TJ Egan <tw15egan@gmail.com>
  • Loading branch information
finken2 and tw15egan committed Mar 7, 2024
1 parent cd5ac20 commit c4b8152
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
Expand Up @@ -7242,7 +7242,7 @@ Map {
"type": "string",
},
"subtitle": Object {
"type": "string",
"type": "node",
},
"title": Object {
"type": "string",
Expand Down
9 changes: 6 additions & 3 deletions packages/react/src/components/Notification/Notification.tsx
Expand Up @@ -1226,7 +1226,7 @@ export interface StaticNotificationProps
/**
* Specify the subtitle
*/
subtitle?: string;
subtitle?: ReactNode;

/**
* Specify the title
Expand Down Expand Up @@ -1295,7 +1295,10 @@ export function StaticNotification({
</div>
<div className={`${prefix}--actionable-notification__button-wrapper`}>
{actionButtonLabel && (
<NotificationActionButton onClick={onActionButtonClick} inline>
<NotificationActionButton
onClick={onActionButtonClick}
aria-describedby={titleId}
inline>
{actionButtonLabel}
</NotificationActionButton>
)}
Expand Down Expand Up @@ -1350,7 +1353,7 @@ StaticNotification.propTypes = {
/**
* Specify the subtitle
*/
subtitle: PropTypes.string,
subtitle: PropTypes.node,

/**
* Specify the title
Expand Down
Expand Up @@ -48,7 +48,20 @@ export const WithInteractiveElements = () => (
</StaticNotification>
);

export const WithActionButton = () => (
export const WithActionButtonOnly = () => (
<StaticNotification
title="Notification title"
titleId="notif-1"
kind="info"
lowContrast
actionButtonLabel="Learn More">
<div className="cds--inline-notification__subtitle">
Here is some important info you might want to know.{' '}
</div>
</StaticNotification>
);

export const WithActionButtonAndLinks = () => (
<StaticNotification
title="Notification title"
titleId="notif-1"
Expand Down

0 comments on commit c4b8152

Please sign in to comment.