Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions packages/ui/src/components/token-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,25 @@ import { Button } from "@crm/ui/components/button";
import { cn } from "@crm/ui/lib/utils";
import type * as React from "react";

function TokenField({ className, ...props }: React.ComponentProps<"div">) {
function TokenField({
className,
disabled,
"aria-disabled": ariaDisabled,
"aria-busy": ariaBusy,
...props
}: React.ComponentProps<"div"> & {
disabled?: boolean;
"aria-disabled"?: boolean | "true" | "false";
"aria-busy"?: boolean | "true" | "false";
}) {
return (
<div
data-slot="token-field"
role="group"
aria-disabled={ariaDisabled ?? disabled}

@cubic-dev-ai cubic-dev-ai Bot Sep 14, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: When a consumer uses the new TokenField disabled prop, the field remains interactive because aria-disabled does not disable editing or descendant buttons. Propagate the disabled state to editable descendants and actions, or provide a shared state mechanism that those children consume.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/ui/src/components/token-field.tsx, line 20:

<comment>When a consumer uses the new `TokenField disabled` prop, the field remains interactive because `aria-disabled` does not disable editing or descendant buttons. Propagate the disabled state to editable descendants and actions, or provide a shared state mechanism that those children consume.</comment>

<file context>
@@ -2,13 +2,25 @@ import { Button } from "@crm/ui/components/button";
 		<div
 			data-slot="token-field"
 			role="group"
+			aria-disabled={ariaDisabled ?? disabled}
+			aria-busy={ariaBusy}
 			className={cn(
</file context>
Fix with cubic

aria-busy={ariaBusy}
className={cn(
"max-h-40 min-h-6 w-full min-w-0 cursor-text overflow-y-auto whitespace-pre-wrap break-words px-1 text-base leading-6 outline-none data-[empty=true]:before:pointer-events-none data-[empty=true]:before:text-muted-foreground data-[empty=true]:before:content-[attr(data-placeholder)] aria-disabled:cursor-not-allowed aria-disabled:opacity-60 sm:text-[15px] md:text-xs [&>[contenteditable]]:outline-none",
"max-h-40 min-h-6 w-full min-w-0 cursor-text overflow-y-auto whitespace-pre-wrap break-words px-1 text-base leading-6 outline-none data-[empty=true]:before:pointer-events-none data-[empty=true]:before:text-muted-foreground data-[empty=true]:before:content-[attr(data-placeholder)] aria-disabled:cursor-not-allowed aria-disabled:opacity-60 aria-busy:cursor-wait sm:text-[15px] md:text-xs [&>[contenteditable]]:outline-none",
className,
)}
{...props}
Expand All @@ -18,13 +30,17 @@ function TokenField({ className, ...props }: React.ComponentProps<"div">) {

function TokenFieldItem({
className,
"aria-disabled": ariaDisabled,
...props
}: React.ComponentProps<"span">) {
}: React.ComponentProps<"span"> & {
"aria-disabled"?: boolean | "true" | "false";
}) {
return (
<span
data-slot="token-field-item"
aria-disabled={ariaDisabled}
className={cn(
"inline-flex h-6 min-w-0 max-w-full shrink-0 items-center gap-1 rounded-lg bg-tag py-0 pr-0.5 pl-0.5 align-middle text-left text-tag-foreground text-xs",
"inline-flex h-6 min-w-0 max-w-full shrink-0 items-center gap-1 rounded-lg bg-tag py-0 pr-0.5 pl-0.5 align-middle text-left text-tag-foreground text-xs aria-disabled:opacity-60",
className,
)}
{...props}
Expand All @@ -34,13 +50,15 @@ function TokenFieldItem({

function TokenFieldAction({
className,
disabled,
...props
}: React.ComponentProps<typeof Button>) {
return (
<Button
type="button"
variant="ghost"
size="icon-xs"
disabled={disabled}
className={cn("size-5 rounded-lg", className)}
{...props}
/>
Expand Down