From b36530f4e6840373797636acea4994ba1f249d42 Mon Sep 17 00:00:00 2001 From: Bilal Karim <4129613+bilal-karim@users.noreply.github.com> Date: Mon, 25 May 2026 12:27:30 -0400 Subject: [PATCH 1/2] fix(a11y): pair Toast variant background with a severity icon (WCAG 1.4.1) Toast variants (success/error/info/warning) previously distinguished severity exclusively by background color. Sighted users with color-vision differences (deuteranopia, protanopia, achromatopsia) could not tell a success toast from an error toast on the surface itself. Add a leading Icon keyed to the variant: success/error/info/ warning each render their named icon; the neutral 'primary' variant (no severity) renders no icon. Icon names match the existing alert.svelte pattern and resolve to confirmed entries in the IconName set. The accessible announcement is unchanged -- Toaster's role="log" still carries the message text via the slot, and the new icon is purely decorative. Affects every toaster.push consumer including cancel/terminate/ reset/signal/pause confirmations, batch actions, deployment edits, and file upload flows. Single primitive-level change; no consumer migration required. Co-Authored-By: Claude Opus 4.6 --- src/lib/holocene/toast.svelte | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lib/holocene/toast.svelte b/src/lib/holocene/toast.svelte index aec2ba28ac..9680a0b3c4 100644 --- a/src/lib/holocene/toast.svelte +++ b/src/lib/holocene/toast.svelte @@ -4,6 +4,7 @@ import { createEventDispatcher } from 'svelte'; import { twMerge as merge } from 'tailwind-merge'; + import type { IconName } from '$lib/holocene/icon'; import Icon from '$lib/holocene/icon/icon.svelte'; import type { ToastVariant } from '$lib/types/holocene'; @@ -17,6 +18,14 @@ warning: 'bg-warning', }; + const variantIcon: Readonly> = { + primary: null, + success: 'success', + error: 'error', + info: 'info', + warning: 'warning', + }; + export let id: string; export let variant: keyof typeof variants; export let closeButtonLabel: string; @@ -34,6 +43,9 @@ )} transition:fly={{ x: 250 }} > + {#if variantIcon[variant]} + + {/if}

From 04521ebe9bc8169e2ac33788997bbfbb5b313575 Mon Sep 17 00:00:00 2001 From: Bilal Karim <4129613+bilal-karim@users.noreply.github.com> Date: Mon, 25 May 2026 12:41:14 -0400 Subject: [PATCH 2/2] fix(types): narrow Icon name from IconName|null via reactive var temporal-cicd flagged a TS warning on the conditional Icon render: the expression variantIcon[variant] is typed IconName|null but Icon's name prop expects IconName. Svelte template doesn't narrow the type through the {#if} guard. Extract the lookup into a reactive `$: icon = variantIcon[variant]` in the script so the {#if icon} guard narrows icon to IconName (non-null) for the Icon prop. Pure type refactor -- runtime behavior identical. Co-Authored-By: Claude Opus 4.6 --- src/lib/holocene/toast.svelte | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/holocene/toast.svelte b/src/lib/holocene/toast.svelte index 9680a0b3c4..49490d17d4 100644 --- a/src/lib/holocene/toast.svelte +++ b/src/lib/holocene/toast.svelte @@ -30,6 +30,8 @@ export let variant: keyof typeof variants; export let closeButtonLabel: string; + $: icon = variantIcon[variant]; + const handleDismiss = () => { dispatch('dismiss', { id }); }; @@ -43,8 +45,8 @@ )} transition:fly={{ x: 250 }} > - {#if variantIcon[variant]} - + {#if icon} + {/if}