Skip to content

Select component from Radix UI (used by shadcn) doesn't enforce HTML5 validation like native inputs. #36

@LeyoNeuroAI

Description

@LeyoNeuroAI

Despite select having required the form accepts blank submission cursor AI states this is a shadcn component issue

code

<Field>
               <FieldLabel htmlFor="industry">Industry</FieldLabel>
               <Select
                 value={formData.industry}
                 onValueChange={(value) => handleSelectChange("industry", value)}
                 required
               >
                 <SelectTrigger id="industry" className="w-full">
                   <SelectValue placeholder="Select an industry" />
                 </SelectTrigger>
                 <SelectContent className="max-h-[300px]">
                   {industries.map((industry) => (
                     <SelectItem key={industry} value={industry}>
                       {industry}
                     </SelectItem>
                   ))}
                 </SelectContent>
               </Select>
             </Field>

Is there a fix or advice for this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions