Skip to content

Commit

Permalink
fix(a11y): increase toast timeout to 10s for WCAG compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsuriel03 committed Oct 30, 2024
1 parent e348908 commit 74a47a3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/components/alerts/toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,19 @@ export const Toasts: React.FC<{ children: React.ReactNode }> = ({ children }) =>
[sortToasts],
)}
>
<ToastPrimitive.Provider swipeDirection="right">
<ToastPrimitive.Provider duration={10000} swipeDirection="right">
{children}
{Array.from(toasts).map(([key, toast]) => (
<Toast
key={key}
id={key}
toast={toast}
toast={{
...toast,
duration: Math.max(
toast.duration || 10000,
toast.status === 'error' ? 12000 : 10000
),
}}
onOpenChange={(open) => {
if (!open) {
toastElementsMapRef.current.delete(key);
Expand Down

0 comments on commit 74a47a3

Please sign in to comment.