Skip to content

Commit

Permalink
chore(store): add defaultAriaProps to mergedToasts
Browse files Browse the repository at this point in the history
  • Loading branch information
daangnkim committed Jan 30, 2025
1 parent 21d4326 commit 0beaee3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ export const defaultTimeouts: {
custom: 4000,
};

const defaultAriaProps = {
role: 'status',
'aria-live': 'polite',
} as const;

export const useStore = (toastOptions: DefaultToastOptions = {}): State => {
const [state, setState] = useState<State>(memoryState);
useEffect(() => {
Expand All @@ -154,6 +159,7 @@ export const useStore = (toastOptions: DefaultToastOptions = {}): State => {
}, [state]);

const mergedToasts = state.toasts.map((t) => ({
ariaProps: defaultAriaProps,
...toastOptions,
...toastOptions[t.type],
...t,
Expand Down

0 comments on commit 0beaee3

Please sign in to comment.