Skip to content

Commit

Permalink
fix(Notification): label notification with subtitle if title not pres…
Browse files Browse the repository at this point in the history
…ent (#14609)
  • Loading branch information
tw15egan authored Sep 14, 2023
1 parent 47ff517 commit 811767b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/react/src/components/Notification/Notification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,7 @@ export function ActionableNotification({
const [isOpen, setIsOpen] = useState(true);
const prefix = usePrefix();
const id = useId('actionable-notification');
const subtitleId = useId('actionable-notification-subtitle');
const containerClassName = cx(className, {
[`${prefix}--actionable-notification`]: true,
[`${prefix}--actionable-notification--toast`]: !inline,
Expand Down Expand Up @@ -975,7 +976,7 @@ export function ActionableNotification({
ref={ref}
role={role}
className={containerClassName}
aria-labelledby={title ? id : undefined}>
aria-labelledby={title ? id : subtitleId}>
<div className={`${prefix}--actionable-notification__details`}>
<NotificationIcon
notificationType={inline ? 'inline' : 'toast'}
Expand All @@ -992,7 +993,9 @@ export function ActionableNotification({
</div>
)}
{subtitle && (
<div className={`${prefix}--actionable-notification__subtitle`}>
<div
className={`${prefix}--actionable-notification__subtitle`}
id={subtitleId}>
{subtitle}
</div>
)}
Expand Down

0 comments on commit 811767b

Please sign in to comment.