mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
fix: FormItemLayout does not apply item id correctly (#49593)
## Problem `<FormItemLayout>` does not apply item id correctly. This can be seen on https://supabase.com/design-system/docs/ui-patterns/forms: open the devtool and check the form items labels. They have no `for` attribute. This makes it harder to correctly test and is an accessibility issue. Axe devtool actually report it ## Solution When inside React Hook Form, `<FormItemLayout>` actually generate an `id` (via `<FormItem>`). However, this `id` is overridden in `<FormLayout>` and read from context by `<FormLabel>`. Simply removing this line fixes it and correctly binds the label to its input
This commit is contained in:
1 parent
961fc749d4
commit
df48528443
1 file changed
-1
@@ -398,7 +398,6 @@ export const FormLayout = React.forwardRef<
|
||||
<FormLabel
|
||||
className="text-foreground flex gap-2 items-center wrap-break-word"
|
||||
data-formlayout-id="formLabel"
|
||||
htmlFor={props.name || id}
|
||||
>
|
||||
<LabelContents />
|
||||
</FormLabel>
|
||||
|
||||
Reference in new issue
Block a user