Skip to content

Commit ac11334

Browse files
authored
[PRM-45] WCAG 3.3.2: Missing label on file upload form input control (#602)
* Gives Select Files button an aria label described by fieldset legend * Edits tests to use new label
1 parent 36144c3 commit ac11334

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

app/src/components/blocks/_lloydGeorge/lloydGeorgeFileInputStage/LloydGeorgeFileInputStage.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ describe('<LloydGeorgeFileInputStage />', () => {
8383
screen.getByText('NHS number: ' + formatNhsNumber(mockPatient.nhsNumber)),
8484
).toBeInTheDocument();
8585

86-
expect(screen.getByRole('button', { name: 'Select files' })).toBeInTheDocument();
86+
expect(
87+
screen.getByRole('button', { name: 'Select the files you wish to upload' }),
88+
).toBeInTheDocument();
8789

8890
expect(screen.getByRole('button', { name: 'Upload' })).toBeInTheDocument();
8991
expect(screen.getByRole('button', { name: 'Upload' })).toBeEnabled();

app/src/components/blocks/_lloydGeorge/lloydGeorgeFileInputStage/LloydGeorgeFileInputStage.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ function LloydGeorgeFileInputStage({ documents, setDocuments, submitDocuments }:
161161
</p>
162162
<p>You will not be able to view a partially uploaded record.</p>
163163
</div>
164-
<Fieldset.Legend size="m">Select the files you wish to upload</Fieldset.Legend>
164+
<Fieldset.Legend id="upload-fieldset-legend" size="m">
165+
Select the files you wish to upload
166+
</Fieldset.Legend>
165167
<Fieldset>
166168
<div
167169
role="button"
@@ -202,6 +204,7 @@ function LloydGeorgeFileInputStage({ documents, setDocuments, submitDocuments }:
202204
onClick={() => {
203205
fileInputRef.current?.click();
204206
}}
207+
aria-labelledby="upload-fieldset-legend"
205208
>
206209
Select files
207210
</Button>

0 commit comments

Comments
 (0)