Skip to content

Commit 7baeb21

Browse files
juliajforestiCopilot
andcommitted
fix: a11y in PruneMessages
Co-authored-by: Copilot <copilot@github.com>
1 parent 5e4aeb6 commit 7baeb21

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

apps/meteor/client/views/room/contextualBar/PruneMessages/PruneMessagesDateTimeRow.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Field, FieldLabel, InputBox, Box, Margins } from '@rocket.chat/fuselage';
2-
import type { ReactElement } from 'react';
1+
import { Box, Margins, Field, FieldLabel, InputBox } from '@rocket.chat/fuselage';
2+
import { useId, type ReactElement } from 'react';
33
import { useFormContext } from 'react-hook-form';
44

55
type PruneMessagesDateTimeRowProps = {
@@ -9,14 +9,17 @@ type PruneMessagesDateTimeRowProps = {
99

1010
const PruneMessagesDateTimeRow = ({ label, field }: PruneMessagesDateTimeRowProps): ReactElement => {
1111
const { register } = useFormContext();
12+
const fieldId = useId();
1213

1314
return (
1415
<Field>
15-
<FieldLabel flexGrow={0}>{label}</FieldLabel>
16+
<FieldLabel id={fieldId} flexGrow={0}>
17+
{label}
18+
</FieldLabel>
1619
<Box display='flex' mi='neg-x4'>
1720
<Margins inline={4}>
18-
<InputBox type='date' flexGrow={1} h='x20' {...register(`${field}.date`)} />
19-
<InputBox type='time' flexGrow={1} h='x20' {...register(`${field}.time`)} />
21+
<InputBox aria-labelledby={fieldId} type='date' flexGrow={1} h='x20' {...register(`${field}.date`)} />
22+
<InputBox aria-labelledby={fieldId} type='time' flexGrow={1} h='x20' {...register(`${field}.time`)} />
2023
</Margins>
2124
</Box>
2225
</Field>

0 commit comments

Comments
 (0)