Skip to content

Commit adf7ebe

Browse files
committed
fix: let the field wire its own label association
1 parent c6f1838 commit adf7ebe

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

apps/meteor/client/views/account/profile/AccountProfileForm.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
} from '@rocket.chat/ui-contexts';
2828
import { useMutation } from '@tanstack/react-query';
2929
import type { AllHTMLAttributes, ChangeEvent } from 'react';
30-
import { useCallback, useEffect, useId, useMemo } from 'react';
30+
import { useCallback, useEffect, useMemo } from 'react';
3131
import { Controller, useFormContext } from 'react-hook-form';
3232

3333
import type { AccountProfileFormValues } from './getProfileInitialValues';
@@ -48,7 +48,6 @@ const AccountProfileForm = (props: AllHTMLAttributes<HTMLFormElement>) => {
4848

4949
const setPreferences = useEndpoint('POST', '/v1/users.setPreferences');
5050
const statusVisibilityEnabled = useSetting('Accounts_StatusVisibility_Enabled', false);
51-
const statusVisibilityDeniedId = useId();
5251
const checkUsernameAvailability = useEndpoint('GET', '/v1/users.checkUsernameAvailability');
5352
const sendConfirmationEmail = useEndpoint('POST', '/v1/users.sendConfirmationEmail');
5453

@@ -291,14 +290,12 @@ const AccountProfileForm = (props: AllHTMLAttributes<HTMLFormElement>) => {
291290
</Field>
292291
{statusVisibilityEnabled && (
293292
<Field>
294-
<FieldLabel htmlFor={statusVisibilityDeniedId}>{t('Accounts_StatusVisibility_Denied_Own')}</FieldLabel>
293+
<FieldLabel>{t('Accounts_StatusVisibility_Denied_Own')}</FieldLabel>
295294
<FieldRow>
296295
<Controller
297296
control={control}
298297
name='statusVisibilityDenied'
299-
render={({ field: { onChange, value } }) => (
300-
<UserAutoCompleteMultiple id={statusVisibilityDeniedId} value={value} onChange={onChange} />
301-
)}
298+
render={({ field: { onChange, value } }) => <UserAutoCompleteMultiple value={value} onChange={onChange} />}
302299
/>
303300
</FieldRow>
304301
<FieldHint>{t('Accounts_StatusVisibility_Denied_Own_Description')}</FieldHint>

0 commit comments

Comments
 (0)