fix(web): name combobox chip removal targets (#10127)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Alex Southwellandgithub-actions[bot] authored and GitHub committed 2026-09-06 00:22:21 -07:00
1 parent 82689782ee
commit 55333833ec
1 file changed
+15 -5
+15 -5
View File
@@ -352,27 +352,37 @@ function ComboboxChips({
}
function ComboboxChip({ children, ...props }: ComboboxPrimitive.Chip.Props) {
const labelId = React.useId();
return (
<ComboboxPrimitive.Chip
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"
data-slot="combobox-chip"
{...props}
>
{children}
<ComboboxChipRemove />
<span id={labelId}>{children}</span>
<ComboboxChipRemove labelId={labelId} />
</ComboboxPrimitive.Chip>
);
}
function ComboboxChipRemove(props: ComboboxPrimitive.ChipRemove.Props) {
function ComboboxChipRemove({
labelId,
...props
}: ComboboxPrimitive.ChipRemove.Props & { labelId: string }) {
const removeLabelId = `${labelId}-remove`;
return (
<ComboboxPrimitive.ChipRemove
aria-label="Remove"
aria-labelledby={`${removeLabelId} ${labelId}`}
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"
data-slot="combobox-chip-remove"
{...props}
>
<XIcon />
<span id={removeLabelId} className="sr-only">
Remove
</span>
<XIcon aria-hidden="true" />
</ComboboxPrimitive.ChipRemove>
);
}