Skip to content

Commit 8c0ce1e

Browse files
feat(toaster): add support for custom aria labels (#704)
1 parent 3ba7aa1 commit 8c0ce1e

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,7 @@ const Toaster = React.forwardRef<HTMLElement, ToasterProps>(function Toaster(pro
610610
dir = getDocumentDirection(),
611611
gap = GAP,
612612
icons,
613+
customAriaLabel,
613614
containerAriaLabel = 'Notifications',
614615
} = props;
615616
const [toasts, setToasts] = React.useState<ToastT[]>([]);
@@ -773,7 +774,7 @@ const Toaster = React.forwardRef<HTMLElement, ToasterProps>(function Toaster(pro
773774
// Remove item from normal navigation flow, only available via hotkey
774775
<section
775776
ref={ref}
776-
aria-label={`${containerAriaLabel} ${hotkeyLabel}`}
777+
aria-label={customAriaLabel ?? `${containerAriaLabel} ${hotkeyLabel}`}
777778
tabIndex={-1}
778779
aria-live="polite"
779780
aria-relevant="additions text"

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ export interface ToasterProps {
145145
dir?: 'rtl' | 'ltr' | 'auto';
146146
swipeDirections?: SwipeDirection[];
147147
icons?: ToastIcons;
148+
customAriaLabel?: string;
148149
containerAriaLabel?: string;
149150
}
150151

0 commit comments

Comments
 (0)