Skip to content
Draft
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,41 @@ interface LabelsInputStepProps {
eventId: GitHubTriggerEventId;
owner: string;
repo: string;
initialLabels?: string[];
onBack: () => void;
onSubmit: (
e: FormEvent<HTMLFormElement>,
rawLabels: { id: number; value: string }[],
) => void;
errorMessage?: string;
isPending: boolean;
labelsError: string | null;
showBackButton?: boolean;
}

export function LabelsInputStep({
eventId,
owner,
repo,
initialLabels,
onBack,
onSubmit,
errorMessage,
isPending,
labelsError,
showBackButton = true,
}: LabelsInputStepProps) {
const [labels, setLabels] = useState([{ id: 1, value: "" }]);
const [nextId, setNextId] = useState(2);
const [labels, setLabels] = useState(() =>
initialLabels !== undefined && initialLabels.length > 0
? initialLabels.map((value, index) => ({
id: index + 1,
value,
}))
: [{ id: 1, value: "" }],
);
const [nextId, setNextId] = useState(
initialLabels !== undefined && initialLabels.length > 0
? initialLabels.length + 1
: 2,
);

return (
<form
Expand Down Expand Up @@ -71,12 +86,12 @@ export function LabelsInputStep({
)
}
className={clsx(
"flex-1 rounded-[8px] py-[8px] px-[12px] outline-none focus:outline-none",
labelsError
? "border border-red-500 focus:border-red-400"
"flex-1 rounded-[8px] py-[8px] px-[12px] outline-none focus:outline-none text-[14px] bg-transparent",
errorMessage !== undefined
? "border border-[#FF3D71] focus:border-[#FF3D71]"
: "border border-white-400 focus:border-border",
"text-[14px] bg-transparent",
)}
required={true}
Copy link

Copilot AI Oct 17, 2025

Choose a reason for hiding this comment

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

The required={true} attribute is unnecessary since true is the default value when the attribute is present. Use required instead for cleaner JSX.

Suggested change
required={true}
required

Copilot uses AI. Check for mistakes.
Copy link

Choose a reason for hiding this comment

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

Bug: HTML5 Validation Conflicts with Custom Logic

The required={true} attribute on label inputs conflicts with the custom validation. The browser's HTML5 validation prevents form submission if any label input is empty, even though the custom logic allows this as long as one label has a value. This blocks users from submitting valid forms.

Fix in Cursor Fix in Web

placeholder="bug"
/>
{labels.length > 1 && (
Expand All @@ -93,14 +108,15 @@ export function LabelsInputStep({
)}
</div>
))}
{labelsError ? (
<p className="text-[12px] text-red-400 pl-2">{labelsError}</p>
) : (
<p className="text-[12px] text-inverse pl-2">
Labels are required for issue labeled triggers. Examples: bug,
feature, urgent
{errorMessage !== undefined && (
<p className="text-[12px] text-[#FF3D71] pl-2" role="alert">
{errorMessage}
</p>
)}
<p className="text-[12px] text-inverse pl-2">
Labels are required for issue labeled triggers. Examples: bug,
feature, urgent
</p>
<button
type="button"
onClick={() => {
Expand All @@ -116,17 +132,22 @@ export function LabelsInputStep({
</fieldset>

<div className="pt-[8px] flex gap-[8px] mt-[12px] px-[4px]">
<button
type="button"
className="flex-1 bg-bg-700 hover:bg-bg-600 text-inverse font-medium px-4 py-2 rounded-md text-[14px] transition-colors disabled:opacity-50 relative"
onClick={onBack}
disabled={isPending}
>
<span className={isPending ? "opacity-0" : ""}>Back</span>
</button>
{showBackButton && (
<button
type="button"
className="flex-1 bg-bg-700 hover:bg-bg-600 text-inverse font-medium px-4 py-2 rounded-md text-[14px] transition-colors disabled:opacity-50 relative"
onClick={onBack}
disabled={isPending}
>
<span className={isPending ? "opacity-0" : ""}>Back</span>
</button>
)}
<button
type="submit"
className="flex-1 bg-primary-900 hover:bg-primary-800 text-inverse font-medium px-4 py-2 rounded-md text-[14px] transition-colors disabled:opacity-50 relative"
className={clsx(
"bg-primary-900 hover:bg-primary-800 text-inverse font-medium px-4 py-2 rounded-md text-[14px] transition-colors disabled:opacity-50 relative",
showBackButton ? "flex-1" : "w-full",
)}
disabled={isPending}
>
<span className={isPending ? "opacity-0" : ""}>
Expand Down
Loading