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
wherehows committed Jan 14, 2024
1 parent 7f85f4e commit 96426cf
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 @@ -180,6 +180,11 @@ export const defaultTimeouts: {

export const useStore = (toastOptions: DefaultToastOptions = {}): State => {
const [state, setState] = useState<State>(memoryState);
const defaultAriaProps = {
role: 'status',
'aria-live': 'polite',
} as const;

useEffect(() => {
listeners.push(setState);
return () => {
Expand All @@ -191,6 +196,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 96426cf

Please sign in to comment.