Fixed Radix UI related custom validity error (#20829)

ref DES-755

- a direct child of a form control primitive should be a form element
- for TextField component, a div was the direct child
- this moves the input element to the form control primitive
This commit is contained in:
Sodbileg Gansukh 2024-08-27 18:17:39 +08:00 committed by GitHub
parent 9449e0a048
commit 0cf987ebff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -107,13 +107,13 @@ const TextField: React.FC<TextFieldProps> = ({
field = ( field = (
<FormPrimitive.Field name={id} asChild> <FormPrimitive.Field name={id} asChild>
<FormPrimitive.Control asChild> <div className={fieldContainerClasses}>
<div className={fieldContainerClasses}> <FormPrimitive.Control asChild>
{inputField} {inputField}
{!unstyled && !clearBg && <div className={bgClasses ? bgClasses : ''}></div>} </FormPrimitive.Control>
{rightPlaceholder && <span className={rightPlaceholderClasses || ''}>{rightPlaceholder}</span>} {!unstyled && !clearBg && <div className={bgClasses ? bgClasses : ''}></div>}
</div> {rightPlaceholder && <span className={rightPlaceholderClasses || ''}>{rightPlaceholder}</span>}
</FormPrimitive.Control> </div>
</FormPrimitive.Field> </FormPrimitive.Field>
); );