Skip to content

Commit

Permalink
Turn wcag criteria notes into a partial
Browse files Browse the repository at this point in the history
  • Loading branch information
owenatgov committed Aug 20, 2024
1 parent bd664f0 commit 9842464
Show file tree
Hide file tree
Showing 37 changed files with 266 additions and 394 deletions.
28 changes: 11 additions & 17 deletions src/components/back-link/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ layout: layout-pane.njk

{% from "_example.njk" import example %}
{% from "_wcag-callout.njk" import wcagCallout %}
{% from "govuk/components/tag/macro.njk" import govukTag %}
{% from "_wcag-note.njk" import wcagNote %}

Use the back link component to help users go back to the previous page in a multi-page transaction.

Expand Down Expand Up @@ -49,22 +49,16 @@ Always place back links at the top of a page, before the `<main>` element. Placi

Make sure the link takes users to the previous page they were on, in the state they last saw it.

<div class="app-wcag-22" id="wcag-avoid-information-reentry" role="note">
{{ govukTag({
text: "WCAG 2.2",
classes: "app-tag"
}) }}
<p>If a user decides to go back to a previous page, make sure information they have already entered is pre-populated.</p>
<p>Do not pre-populate if the information is no longer valid, or when pre-populating would be a major safety or security concern. This is to comply with WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/redundant-entry.html">3.3.7 Redundant entry</a>.</p>
</div>

<div class="app-wcag-22" id="wcag-interact-back-links" role="note">
{{ govukTag({
text: "WCAG 2.2",
classes: "app-tag"
}) }}
<p>Make sure no other interactive elements are too close to the back link. This is to make sure users can easily interact with the back link. This relates to WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html">2.5.8 Target size (minimum)</a>.</p>
</div>
{% call wcagNote({id: "wcag-avoid-information-reentry"}) %}

<p>If a user decides to go back to a previous page, make sure information they have already entered is pre-populated.</p>
<p>Do not pre-populate if the information is no longer valid, or when pre-populating would be a major safety or security concern. This is to comply with WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/redundant-entry.html">3.3.7 Redundant entry</a>.</p>
{% endcall %}

{% call wcagNote({id: "wcag-interact-back-links"}) %}

<p>Make sure no other interactive elements are too close to the back link. This is to make sure users can easily interact with the back link. This relates to WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html">2.5.8 Target size (minimum)</a>.</p>
{% endcall %}

Where possible, ensure the back link works even when JavaScript is not available. If this is not possible, you should hide the back link when JavaScript is not available.

Expand Down
13 changes: 5 additions & 8 deletions src/components/breadcrumbs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ layout: layout-pane.njk

{% from "_example.njk" import example %}
{% from "_wcag-callout.njk" import wcagCallout %}
{% from "govuk/components/tag/macro.njk" import govukTag %}
{% from "_wcag-note.njk" import wcagNote %}

The breadcrumbs component helps users to understand where they are within a website’s structure and move between levels.

Expand Down Expand Up @@ -43,13 +43,10 @@ Always place breadcrumbs at the top of a page, before the `<main>` element. Plac

The breadcrumbs should start with your 'home' page and end with the parent section of the current page.

<div class="app-wcag-22" id="wcag-interact-breadcrumbs" role="note">
{{ govukTag({
text: "WCAG 2.2",
classes: "app-tag"
}) }}
<p>Make sure no other interactive elements are too close to the breadcrumbs. This is to make sure users can easily interact with the breadcrumbs. This relates to WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html">2.5.8 Target size (minimum)</a>.</p>
</div>
{% call wcagNote({id: "wcag-interact-breadcrumbs"}) %}

<p>Make sure no other interactive elements are too close to the breadcrumbs. This is to make sure users can easily interact with the breadcrumbs. This relates to WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html">2.5.8 Target size (minimum)</a>.</p>
{% endcall %}

There are 2 ways to use the breadcrumbs component. You can use HTML or, if you are using [Nunjucks](https://mozilla.github.io/nunjucks/) or the [GOV.UK Prototype Kit](https://prototype-kit.service.gov.uk), you can use the Nunjucks macro.

Expand Down
13 changes: 5 additions & 8 deletions src/components/button/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ layout: layout-pane.njk

{% from "_example.njk" import example %}
{% from "_wcag-callout.njk" import wcagCallout %}
{% from "govuk/components/tag/macro.njk" import govukTag %}
{% from "_wcag-note.njk" import wcagNote %}

{{ wcagCallout({
type: "component",
Expand Down Expand Up @@ -48,13 +48,10 @@ You may need to include more or different words to better describe the action. F

Align the primary action button to the left edge of your form.

<div class="app-wcag-22" id="wcag-interact-button" role="note">
{{ govukTag({
text: "WCAG 2.2",
classes: "app-tag"
}) }}
<p>Do not decrease the height or target area of buttons. This is to make sure users can easily interact with buttons. This is to comply with WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html">2.5.8 Target size (minimum)</a>.</p>
</div>
{% call wcagNote({id: "wcag-interact-button"}) %}

<p>Do not decrease the height or target area of buttons. This is to make sure users can easily interact with buttons. This is to comply with WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html">2.5.8 Target size (minimum)</a>.</p>
{% endcall %}

There are 2 ways to use the button component. You can use HTML or, if you are using [Nunjucks](https://mozilla.github.io/nunjucks/) or the [GOV.UK Prototype Kit](https://prototype-kit.service.gov.uk), you can use the Nunjucks macro.

Expand Down
26 changes: 10 additions & 16 deletions src/components/cookie-banner/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ layout: layout-pane.njk

{% from "_example.njk" import example %}
{% from "_wcag-callout.njk" import wcagCallout %}
{% from "govuk/components/tag/macro.njk" import govukTag %}
{% from "_wcag-note.njk" import wcagNote %}

Allow users to accept or reject cookies which are not essential to making your service work.

Expand Down Expand Up @@ -81,21 +81,15 @@ Make sure the cookie banner does not:

Position the cookie banner after the opening `<body>` tag and before the ’skip to main content‘ link. If you're using the Nunjucks page template, use the `bodyStart` block.

<div class="app-wcag-22" id="wcag-see-focus" role="note">
{{ govukTag({
text: "WCAG 2.2",
classes: "app-tag"
}) }}
<p>Do not make the cookie banner ‘sticky’ to the top of the page by using `position: fixed` or any other method. This is to make sure it does not cover or obscure any content which has a focus applied. This is to comply with WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/focus-not-obscured-minimum.html">2.4.11 Focus not obscured (minimum)</a>.</p>
</div>

<div class="app-wcag-22" id="wcag-interact-cookie-banner" role="note">
{{ govukTag({
text: "WCAG 2.2",
classes: "app-tag"
}) }}
<p>Do not change the padding or margins of buttons and links within the cookie banner. This is to make sure there’s adequate space for the user to interact with the buttons and links. This relates to WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html">2.5.8 Target size (minimum)</a>.</p>
</div>
{% call wcagNote({id: "wcag-see-focus"}) %}

<p>Do not make the cookie banner ‘sticky’ to the top of the page by using `position: fixed` or any other method. This is to make sure it does not cover or obscure any content which has a focus applied. This is to comply with WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/focus-not-obscured-minimum.html">2.4.11 Focus not obscured (minimum)</a>.</p>
{% endcall %}

{% call wcagNote({id: "wcag-interact-cookie-banner"}) %}

<p>Do not change the padding or margins of buttons and links within the cookie banner. This is to make sure there’s adequate space for the user to interact with the buttons and links. This relates to WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html">2.5.8 Target size (minimum)</a>.</p>
{% endcall %}

### Option 1: If you’re only using essential cookies

Expand Down
13 changes: 5 additions & 8 deletions src/components/error-message/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ layout: layout-pane.njk

{% from "_example.njk" import example %}
{% from "_wcag-callout.njk" import wcagCallout %}
{% from "govuk/components/tag/macro.njk" import govukTag %}
{% from "_wcag-note.njk" import wcagNote %}

This guidance is for government teams that build online services. [To find information and services for the public, go to GOV.UK](https://www.gov.uk/).

Expand Down Expand Up @@ -55,13 +55,10 @@ For each error:
- use a red border to visually connect the message and the question it belongs to
- if the error relates to a specific field within the question, give it a red border and refer to that field in the error message - for example: "you must enter a year"

<div class="app-wcag-22" id="wcag-clear-answers-error" role="note">
{{ govukTag({
text: "WCAG 2.2",
classes: "app-tag"
}) }}
<p>Do not clear any form fields when adding error messages. This is to comply with WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/redundant-entry.html">3.3.7 Redundant entry</a>.</p>
</div>
{% call wcagNote({id: "wcag-clear-answers-error"}) %}

<p>Do not clear any form fields when adding error messages. This is to comply with WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/redundant-entry.html">3.3.7 Redundant entry</a>.</p>
{% endcall %}

Keeping information that caused errors helps users to:

Expand Down
30 changes: 12 additions & 18 deletions src/components/file-upload/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ layout: layout-pane.njk

{% from "_example.njk" import example %}
{% from "_wcag-callout.njk" import wcagCallout %}
{% from "govuk/components/tag/macro.njk" import govukTag %}
{% from "_wcag-note.njk" import wcagNote %}

This guidance is for government teams that build online services. [To find information and services for the public, go to GOV.UK](https://www.gov.uk/).

Expand Down Expand Up @@ -44,23 +44,17 @@ To upload a file, the user can either:
- use the ‘Choose file’ button
- ‘drag and drop’ a file into the file upload input area

<div class="app-wcag-22" id="wcag-multi-method-drag-drop" role="note">
{{ govukTag({
text: "WCAG 2.2",
classes: "app-tag"
}) }}
<p>Do not use ‘drag and drop’ as the only way to upload files. You must provide another method, such as the ‘Choose file’ button. This is to comply with WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/dragging-movements.html">2.5.7 Dragging movements</a>.</p>
</div>

<div class="app-wcag-22" id="wcag-use-previous-uploads" role="note">
{{ govukTag({
text: "WCAG 2.2",
classes: "app-tag"
}) }}
<p>Make sure users can easily reuse a previously uploaded file within a single journey, unless doing so would be a major security or privacy concern.</p>
<p>For example, a user might need to upload a photo of their driving licence to prove their identity, and again to prove their address.</p>
<p>You can make it easier for the user to reuse a file by showing it as an option for the user to select instead of the file upload. Consider users on public devices before choosing to make the file available to preview or download. This is to comply with WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/redundant-entry.html">3.3.7 Redundant entry</a>.</p>
</div>
{% call wcagNote({id: "wcag-multi-method-drag-drop"}) %}

<p>Do not use ‘drag and drop’ as the only way to upload files. You must provide another method, such as the ‘Choose file’ button. This is to comply with WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/dragging-movements.html">2.5.7 Dragging movements</a>.</p>
{% endcall %}

{% call wcagNote({id: "wcag-use-previous-uploads"}) %}

<p>Make sure users can easily reuse a previously uploaded file within a single journey, unless doing so would be a major security or privacy concern.</p>
<p>For example, a user might need to upload a photo of their driving licence to prove their identity, and again to prove their address.</p>
<p>You can make it easier for the user to reuse a file by showing it as an option for the user to select instead of the file upload. Consider users on public devices before choosing to make the file available to preview or download. This is to comply with WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/redundant-entry.html">3.3.7 Redundant entry</a>.</p>
{% endcall %}

There are 2 ways to use the file upload component. You can use HTML or, if you’re using [Nunjucks](https://mozilla.github.io/nunjucks/) or the [GOV.UK Prototype Kit](https://prototype-kit.service.gov.uk), you can use the Nunjucks macro.

Expand Down
13 changes: 5 additions & 8 deletions src/components/footer/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ layout: layout-pane.njk

{% from "_example.njk" import example %}
{% from "_wcag-callout.njk" import wcagCallout %}
{% from "govuk/components/tag/macro.njk" import govukTag %}
{% from "_wcag-note.njk" import wcagNote %}

The footer provides copyright, licensing and other information about your service.

Expand Down Expand Up @@ -60,13 +60,10 @@ You can add links to:

Use ‘Privacy’, ‘Accessibility’, ‘Cookies’ and ‘Terms and conditions’ for the link text.

<div class="app-wcag-22" id="wcag-consistent-links" role="note">
{{ govukTag({
text: "WCAG 2.2",
classes: "app-tag"
}) }}
<p>If you include links to ‘help’ pages within a footer, make sure to place those links consistently within the footer content. Also make sure that ‘help’ links always function in a similar way across each page. This is to comply with WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/consistent-help.html">3.2.6 Consistent help</a>.</p>
</div>
{% call wcagNote({id: "wcag-consistent-links"}) %}

<p>If you include links to ‘help’ pages within a footer, make sure to place those links consistently within the footer content. Also make sure that ‘help’ links always function in a similar way across each page. This is to comply with WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/consistent-help.html">3.2.6 Consistent help</a>.</p>
{% endcall %}

## Adding secondary navigation

Expand Down
28 changes: 11 additions & 17 deletions src/components/header/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ layout: layout-pane.njk

{% from "_example.njk" import example %}
{% from "_wcag-callout.njk" import wcagCallout %}
{% from "govuk/components/tag/macro.njk" import govukTag %}
{% from "_wcag-note.njk" import wcagNote %}

The GOV.UK header shows users that they are on GOV.UK and which service they are using.

Expand Down Expand Up @@ -62,24 +62,18 @@ Use the header with a service name if your service is more than 5 pages long - t

Use the header with navigation if you need to include basic navigation, contact or account management links.

<div class="app-wcag-22" id="wcag-do-not-cover-content" role="note">
{{ govukTag({
text: "WCAG 2.2",
classes: "app-tag"
}) }}
<p>Do not make header elements, like dropdown menus, ‘sticky’ to the top of the page by using `position: fixed` or any other method. In other words, avoid any implementations that cause menus to sit on top of page content.</p>
<p>This is to make sure it does not hide or obscure any content which has a focus applied and comply with WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/focus-not-obscured-minimum.html">2.4.11 Focus not obscured (minimum)</a>.</p>
</div>
{% call wcagNote({id: "wcag-do-not-cover-content"}) %}

<p>Do not make header elements, like dropdown menus, ‘sticky’ to the top of the page by using `position: fixed` or any other method. In other words, avoid any implementations that cause menus to sit on top of page content.</p>
<p>This is to make sure it does not hide or obscure any content which has a focus applied and comply with WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/focus-not-obscured-minimum.html">2.4.11 Focus not obscured (minimum)</a>.</p>
{% endcall %}

In November 2021, [the GOV.UK homepage introduced a menu bar](https://insidegovuk.blog.gov.uk/2021/11/11/launching-gov-uks-new-menu-bar/) that avoids obscuring content by shifting the page down.

{{ example({group: "components", item: "header", example: "with-service-name-and-navigation", html: true, nunjucks: true, open: false, size: "s"}) }}

<div class="app-wcag-22" id="wcag-consistent-help-links" role="note">
{{ govukTag({
text: "WCAG 2.2",
classes: "app-tag"
}) }}
<p>You can add a link to a ‘help’ page in your service’s header. If you do, the link must be positioned consistently within the header, and must always link to the same place.</p>
<p>For example, a header link to “Get help with this service” must go to the same place as similar header links elsewhere in your service. This is to comply with WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/consistent-help.html">3.2.6 Consistent help</a>.</p>
</div>
{% call wcagNote({id: "wcag-consistent-help-links"}) %}

<p>You can add a link to a ‘help’ page in your service’s header. If you do, the link must be positioned consistently within the header, and must always link to the same place.</p>
<p>For example, a header link to “Get help with this service” must go to the same place as similar header links elsewhere in your service. This is to comply with WCAG 2.2 success criterion <a href="https://www.w3.org/WAI/WCAG22/Understanding/consistent-help.html">3.2.6 Consistent help</a>.</p>
{% endcall %}
Loading

0 comments on commit 9842464

Please sign in to comment.