From 147e2a9b787abe85eafb4b8415b6ffb2d5d8d67c Mon Sep 17 00:00:00 2001 From: Oliver Byford Date: Mon, 5 Sep 2022 14:00:14 +0100 Subject: [PATCH] Fix 'wcag/h71' violations Some of our examples have a fieldset with no legend, which violates this rule: >
must have a as the first child [wcag/h71] Add a legend to all examples that use a fieldset and are currently missing a legend. --- src/govuk/components/all.test.js | 4 +--- src/govuk/components/checkboxes/checkboxes.yaml | 2 ++ src/govuk/components/fieldset/fieldset.yaml | 8 ++++++++ src/govuk/components/radios/radios.yaml | 2 ++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/govuk/components/all.test.js b/src/govuk/components/all.test.js index d770c16bb6..c8cf2c6e8f 100644 --- a/src/govuk/components/all.test.js +++ b/src/govuk/components/all.test.js @@ -103,9 +103,7 @@ describe.each(allComponents)('%s', (component) => { // // Relax the rule to allow anything that is valid according to the // spec. - 'valid-id': ['error', { relaxed: true }], - - 'wcag/h71': 'off' + 'valid-id': ['error', { relaxed: true }] }, elements: [ 'html5', diff --git a/src/govuk/components/checkboxes/checkboxes.yaml b/src/govuk/components/checkboxes/checkboxes.yaml index 151203f252..fd9eb740ed 100644 --- a/src/govuk/components/checkboxes/checkboxes.yaml +++ b/src/govuk/components/checkboxes/checkboxes.yaml @@ -699,6 +699,8 @@ examples: name: example-name fieldset: describedBy: some-id + legend: + text: Which option? items: - value: 1 text: Option 1 diff --git a/src/govuk/components/fieldset/fieldset.yaml b/src/govuk/components/fieldset/fieldset.yaml index 1b989233ce..48f1911530 100644 --- a/src/govuk/components/fieldset/fieldset.yaml +++ b/src/govuk/components/fieldset/fieldset.yaml @@ -114,6 +114,8 @@ examples: hidden: true data: describedBy: some-id + legend: + text: Which option? - name: html as text hidden: true data: @@ -134,12 +136,18 @@ examples: hidden: true data: classes: app-fieldset--custom-modifier + legend: + text: Which option? - name: role hidden: true data: role: group + legend: + text: Which option? - name: attributes hidden: true data: attributes: data-attribute: value + legend: + text: Which option? diff --git a/src/govuk/components/radios/radios.yaml b/src/govuk/components/radios/radios.yaml index 7eaa348dbd..0e6228205e 100644 --- a/src/govuk/components/radios/radios.yaml +++ b/src/govuk/components/radios/radios.yaml @@ -692,6 +692,8 @@ examples: name: example-name fieldset: describedBy: some-id + legend: + text: Which option? items: - value: yes text: Yes