Skip to content

Commit

Permalink
Merge pull request #63 from wilsuriel03/fix/increase-toast-timeout
Browse files Browse the repository at this point in the history
fix(a11y): increase toast timeout for WCAG 2.2.1 compliance
  • Loading branch information
wilsuriel03 authored Oct 30, 2024
2 parents b67a809 + 74a47a3 commit 0252e20
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 0252e20

Please sign in to comment.