From 4f92790587cf39faa26ee7b5463ff18bb72477ac Mon Sep 17 00:00:00 2001 From: Gildas Garcia <1122076+djhi@users.noreply.github.com> Date: Mon, 31 Aug 2026 10:32:45 +0200 Subject: [PATCH] fix: FormItemLayout does not apply item id correctly (#49637) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Problem `` 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, `` actually generate an `id` (via ``). However, this `id` is overridden in `` and read from context by ``. Ensure we use the generated id unless one was provided. Also updated the paths filters for the CI check so that any changes in either `ui` or `ui-patterns` triggers the studio unit and e2e tests. ## Summary by CodeRabbit - **Bug Fixes** - Improved form accessibility by ensuring labels consistently connect to their corresponding input fields. - React-based forms now correctly preserve field-specific identifiers when associating labels with inputs. - Added support for explicitly specifying a label’s input target, improving compatibility with customized form layouts. - Updated Studio forms to use consistent control identifiers and labeling behavior. - **Quality Improvements** - Automated validation now also runs when shared UI components and patterns are updated. --- .github/workflows/studio-e2e-test.yml | 2 + .github/workflows/studio-unit-tests.yml | 4 ++ .../AccessTokens/Scoped/Form/TokenDetails.tsx | 6 +-- .../SessionsAuthSettingsForm.tsx | 12 ------ .../Vault/Secrets/EditSecretModal.tsx | 31 +++++++--------- .../Wrappers/CreateWrapperSheet.tsx | 3 +- .../Integrations/Wrappers/InputField.tsx | 7 ++-- .../Wrappers/WrapperTableEditor.tsx | 22 ++++------- .../interfaces/SQLEditor/RenameQueryModal.tsx | 2 +- .../interfaces/Storage/CreateBucketModal.tsx | 37 +++---------------- .../interfaces/Storage/EditBucketModal.tsx | 24 ++---------- .../Support/DashboardLogsToggle.tsx | 19 ++++++---- .../Support/SupportAccessToggle.tsx | 20 ++++++---- .../src/form/Layout/FormLayout.tsx | 2 +- packages/ui/src/components/shadcn/ui/form.tsx | 4 +- 15 files changed, 70 insertions(+), 125 deletions(-) diff --git a/.github/workflows/studio-e2e-test.yml b/.github/workflows/studio-e2e-test.yml index 9573189273d..67da2f67312 100644 --- a/.github/workflows/studio-e2e-test.yml +++ b/.github/workflows/studio-e2e-test.yml @@ -44,6 +44,8 @@ jobs: filters: | studio: - 'packages/pg-meta/**' + - 'packages/ui/**' + - 'packages/ui-patterns/**' - 'apps/studio/**' - 'apps/ui-library/**' - 'apps/design-system/**' diff --git a/.github/workflows/studio-unit-tests.yml b/.github/workflows/studio-unit-tests.yml index bed6790239f..65e65dabcf4 100644 --- a/.github/workflows/studio-unit-tests.yml +++ b/.github/workflows/studio-unit-tests.yml @@ -8,6 +8,8 @@ on: branches: [master, studio] paths: - 'apps/studio/**' + - 'packages/ui/**' + - 'packages/ui-patterns/**' - 'pnpm-lock.yaml' pull_request: branches: [master, studio] @@ -44,6 +46,8 @@ jobs: with: filters: | relevant: + - 'packages/ui/**' + - 'packages/ui-patterns/**' - 'apps/studio/**' - 'pnpm-lock.yaml' - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 diff --git a/apps/studio/components/interfaces/Account/AccessTokens/Scoped/Form/TokenDetails.tsx b/apps/studio/components/interfaces/Account/AccessTokens/Scoped/Form/TokenDetails.tsx index 64a91e603df..a57127f6b65 100644 --- a/apps/studio/components/interfaces/Account/AccessTokens/Scoped/Form/TokenDetails.tsx +++ b/apps/studio/components/interfaces/Account/AccessTokens/Scoped/Form/TokenDetails.tsx @@ -61,7 +61,7 @@ export const TokenDetails = ({ control, setValue }: TokenDetailsProps) => { render={({ field }) => ( - + )} @@ -72,11 +72,11 @@ export const TokenDetails = ({ control, setValue }: TokenDetailsProps) => { name="expiresAt" control={control} render={({ field }) => ( - +
+ )} @@ -162,7 +162,7 @@ export const EditSecretModal = () => { labelOptional="Optional" > - + )} @@ -173,10 +173,9 @@ export const EditSecretModal = () => { control={form.control} render={({ field }) => ( - -
+
+