fix(a11y): render a warning icon for Chip warning intent (WCAG 1.4.1)#3450
Open
bilal-karim wants to merge 1 commit into
Open
fix(a11y): render a warning icon for Chip warning intent (WCAG 1.4.1)#3450bilal-karim wants to merge 1 commit into
bilal-karim wants to merge 1 commit into
Conversation
The Chip primitive's 'warning' intent previously applied bg-danger
as the only severity signal. Sighted users with color-vision
differences (deuteranopia, protanopia, achromatopsia) could not
identify which chip in a list was the rejected one -- all chips
looked similar in shape.
Render a leading 'warning' Icon when intent === 'warning'. The
icon is decorative (aria-hidden via svg.svelte's default when no
title is passed); the existing aria-live="assertive" hint on the
parent ChipInput continues to carry the AT-readable signal for
validation failures.
Affects ChipInput (chip-input.svelte:128, 189) and Combobox
(combobox.svelte:518) where intent={valid ? 'default' : 'warning'}
is set per chip. Search-attribute filtering, email/ID list inputs,
and similar form surfaces inherit the fix from the primitive.
Mirrors the pattern established by PR #3449 (Toast severity icon)
and the existing Alert primitive (icon defaults to intent).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
Chipprimitive'swarningintent previously appliedbg-dangeras the only severity signal. Sighted users with color-vision differences (deuteranopia, protanopia, achromatopsia) could not identify which chip in a list was the rejected one — all chips looked similar in shape.This PR adds a leading warning icon when
intent === 'warning'. Background color is unchanged. The icon is decorative (renders witharia-hidden="true"viasvg.sveltewhen notitleis passed); the existingaria-live="assertive"hint on the parent<ChipInput>continues to carry the AT-readable signal for validation failures.<span class={merge('chip', intent)}> + {#if intent === 'warning'} + <Icon name="warning" class="shrink-0" /> + {/if} {#if button}Before / After
Invalid chips were previously distinguished only by background color. Now they also carry a warning triangle (⚠) — visible to colorblind users.
Audit context
Affected callsites
A single-primitive fix at
Chipresolves all severity callsites:src/lib/holocene/input/chip-input.svelte:128, 189(`intent={valid ? 'default' : 'warning'}`)src/lib/holocene/combobox/combobox.svelte:518Other Chip consumers use
intent=\"default\"and are unaffected.Functional impact: zero
Pure visual decoration. Verified:
intent,button,removeButtonLabel,disabled,onclick,onremove,children)handleRemovecallback flow unchangedaria-label,data-track-*attributes on close button unchanged.warning { @apply bg-danger }style unchangedaria-livehint on parent unchangedTest plan
chip.stories.svelte—defaultandwarningintents both render correctly<ChipInput>with a mix of valid and invalid values; only invalid chips show the warning iconaria-livehint continues to announce on validation failure; the decorative icon does not double-announceOut of scope
success/info/errorintents (intent set stayswarning+default)aria-invalidto the chip wrapper (would require giving the chip a role — separate decision)🤖 Generated with Claude Code