Skip to content

Commit 7d90c9d

Browse files
ergot-rpergotsedougfabris
authored
feat(a11y): Missing FieldGroup legend in profile page (RocketChat#37119)
Co-authored-by: Erik Göthe <194300518+ergotse@users.noreply.github.com> Co-authored-by: Douglas Fabris <27704687+dougfabris@users.noreply.github.com>
1 parent 67fa491 commit 7d90c9d

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

.changeset/dull-rocks-boil.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@rocket.chat/meteor': minor
3+
---
4+
5+
Adds missing legend for fieldset in profile page to meet WCAG compliance

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
import { useMutation } from '@tanstack/react-query';
2626
import type { AllHTMLAttributes, ReactElement } from 'react';
2727
import { useId, useCallback } from 'react';
28+
import { VisuallyHidden } from 'react-aria';
2829
import { Controller, useFormContext } from 'react-hook-form';
2930

3031
import type { AccountProfileFormValues } from './getProfileInitialValues';
@@ -142,6 +143,9 @@ const AccountProfileForm = (props: AllHTMLAttributes<HTMLFormElement>): ReactEle
142143
return (
143144
<Box {...props} is='form' autoComplete='off' onSubmit={handleSubmit(handleSave)}>
144145
<FieldGroup>
146+
<VisuallyHidden>
147+
<legend>{t('Profile_details')}</legend>
148+
</VisuallyHidden>
145149
<Field>
146150
<Controller
147151
control={control}
@@ -240,7 +244,12 @@ const AccountProfileForm = (props: AllHTMLAttributes<HTMLFormElement>): ReactEle
240244
<Controller
241245
control={control}
242246
name='statusText'
243-
rules={{ maxLength: { value: USER_STATUS_TEXT_MAX_LENGTH, message: t('Max_length_is', USER_STATUS_TEXT_MAX_LENGTH) } }}
247+
rules={{
248+
maxLength: {
249+
value: USER_STATUS_TEXT_MAX_LENGTH,
250+
message: t('Max_length_is', USER_STATUS_TEXT_MAX_LENGTH),
251+
},
252+
}}
244253
render={({ field }) => (
245254
<TextInput
246255
{...field}

0 commit comments

Comments
 (0)