File tree Expand file tree Collapse file tree
apps/web/src/components/ui Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -352,27 +352,37 @@ function ComboboxChips({
352352}
353353
354354function ComboboxChip ( { children, ...props } : ComboboxPrimitive . Chip . Props ) {
355+ const labelId = React . useId ( ) ;
356+
355357 return (
356358 < ComboboxPrimitive . Chip
357359 className = "flex items-center rounded-[calc(var(--radius-md)-1px)] bg-accent ps-2 font-medium text-accent-foreground text-sm outline-none sm:text-xs/(--text-xs--line-height) [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5"
358360 data-slot = "combobox-chip"
359361 { ...props }
360362 >
361- { children }
362- < ComboboxChipRemove />
363+ < span id = { labelId } > { children } </ span >
364+ < ComboboxChipRemove labelId = { labelId } />
363365 </ ComboboxPrimitive . Chip >
364366 ) ;
365367}
366368
367- function ComboboxChipRemove ( props : ComboboxPrimitive . ChipRemove . Props ) {
369+ function ComboboxChipRemove ( {
370+ labelId,
371+ ...props
372+ } : ComboboxPrimitive . ChipRemove . Props & { labelId : string } ) {
373+ const removeLabelId = `${ labelId } -remove` ;
374+
368375 return (
369376 < ComboboxPrimitive . ChipRemove
370- aria-label = "Remove"
377+ aria-labelledby = { ` ${ removeLabelId } ${ labelId } ` }
371378 className = "h-full shrink-0 cursor-pointer px-1.5 opacity-80 hover:opacity-100 [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5"
372379 data-slot = "combobox-chip-remove"
373380 { ...props }
374381 >
375- < XIcon />
382+ < span id = { removeLabelId } className = "sr-only" >
383+ Remove
384+ </ span >
385+ < XIcon aria-hidden = "true" />
376386 </ ComboboxPrimitive . ChipRemove >
377387 ) ;
378388}
You can’t perform that action at this time.
0 commit comments