diff --git a/CHANGELOG.md b/CHANGELOG.md index eb61204907..766f394f6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -102,6 +102,14 @@ If you're importing JavaScript modules individually, you should check any refere This change was introduced in [pull request #2426: Rename exported JavaScript modules to include component name](https://github.com/alphagov/govuk-frontend/pull/2426). +#### Update the HTML for error messages + +We’ve updated the HTML for the error message component to use a paragraph element instead of a span element, as this is more semantically correct. + +If you’re not using Nunjucks macros, swap the `` for a `

`. + +This change was introduced in [pull request #2452: Update error messages to use paragraph tags instead of spans](https://github.com/alphagov/govuk-frontend/pull/2452). + #### Update the HTML for hints In GOV.UK Frontend v3.8.0, we [updated the HTML for hints to use a `

` rather than a `` element, to allow the use of block elements](https://github.com/alphagov/govuk-frontend/issues/1835). We've now removed the styles which made the hint `` display as block. diff --git a/src/govuk/components/character-count/__snapshots__/template.test.js.snap b/src/govuk/components/character-count/__snapshots__/template.test.js.snap index 181547d4d2..44c23cb9fb 100644 --- a/src/govuk/components/character-count/__snapshots__/template.test.js.snap +++ b/src/govuk/components/character-count/__snapshots__/template.test.js.snap @@ -15,11 +15,11 @@ exports[`Character count when it includes a hint renders with hint 1`] = ` `; exports[`Character count when it includes an error message renders with error message 1`] = ` - Please do not exceed the maximum allowed limit - +

`; exports[`Character count with dependant components renders with label 1`] = ` diff --git a/src/govuk/components/checkboxes/__snapshots__/template.test.js.snap b/src/govuk/components/checkboxes/__snapshots__/template.test.js.snap index 1f410705f4..ae25a7cdd4 100644 --- a/src/govuk/components/checkboxes/__snapshots__/template.test.js.snap +++ b/src/govuk/components/checkboxes/__snapshots__/template.test.js.snap @@ -55,9 +55,9 @@ exports[`Checkboxes when they include a hint renders the hint 1`] = ` `; exports[`Checkboxes when they include an error message renders the error message 1`] = ` - Please select an option - +

`; diff --git a/src/govuk/components/date-input/__snapshots__/template.test.js.snap b/src/govuk/components/date-input/__snapshots__/template.test.js.snap index 49dca39f67..f738555f2e 100644 --- a/src/govuk/components/date-input/__snapshots__/template.test.js.snap +++ b/src/govuk/components/date-input/__snapshots__/template.test.js.snap @@ -52,9 +52,9 @@ exports[`Date input when it includes a hint renders the hint 1`] = ` `; exports[`Date input when it includes an error message renders the error message 1`] = ` - Error message goes here - +

`; diff --git a/src/govuk/components/error-message/_index.scss b/src/govuk/components/error-message/_index.scss index 5cfa5394ca..ae4f6d0740 100644 --- a/src/govuk/components/error-message/_index.scss +++ b/src/govuk/components/error-message/_index.scss @@ -3,6 +3,7 @@ @include govuk-font($size: 19, $weight: bold); display: block; + margin-top: 0; // Reset any default browser margins for paragraphs margin-bottom: govuk-spacing(3); clear: both; diff --git a/src/govuk/components/error-message/template.njk b/src/govuk/components/error-message/template.njk index be452167f2..143f38f357 100644 --- a/src/govuk/components/error-message/template.njk +++ b/src/govuk/components/error-message/template.njk @@ -1,6 +1,6 @@ {% set visuallyHiddenText = params.visuallyHiddenText | default("Error") -%} - +

{% if visuallyHiddenText %}{{ visuallyHiddenText }}: {% endif -%} {{ params.html | safe if params.html else params.text }} - +

diff --git a/src/govuk/components/file-upload/__snapshots__/template.test.js.snap b/src/govuk/components/file-upload/__snapshots__/template.test.js.snap index ad3456d51b..3134a6a06d 100644 --- a/src/govuk/components/file-upload/__snapshots__/template.test.js.snap +++ b/src/govuk/components/file-upload/__snapshots__/template.test.js.snap @@ -9,11 +9,11 @@ exports[`File upload when it includes a hint renders with hint 1`] = ` `; exports[`File upload when it includes an error message renders with error message 1`] = ` - Error message - +

`; exports[`File upload with dependant components renders with label 1`] = ` diff --git a/src/govuk/components/input/__snapshots__/template.test.js.snap b/src/govuk/components/input/__snapshots__/template.test.js.snap index 2d657e0ee6..9b17219798 100644 --- a/src/govuk/components/input/__snapshots__/template.test.js.snap +++ b/src/govuk/components/input/__snapshots__/template.test.js.snap @@ -9,11 +9,11 @@ exports[`Input when it includes a hint renders the hint 1`] = ` `; exports[`Input when it includes an error message renders the error message 1`] = ` - Error message goes here - +

`; exports[`Input with dependant components renders with label 1`] = ` diff --git a/src/govuk/components/radios/__snapshots__/template.test.js.snap b/src/govuk/components/radios/__snapshots__/template.test.js.snap index 3e9af7c04f..a1b94ddd4e 100644 --- a/src/govuk/components/radios/__snapshots__/template.test.js.snap +++ b/src/govuk/components/radios/__snapshots__/template.test.js.snap @@ -53,9 +53,9 @@ exports[`Radios when they include a hint renders the hint 1`] = ` `; exports[`Radios when they include an error message renders the error message 1`] = ` - Please select an option - +

`; diff --git a/src/govuk/components/select/__snapshots__/template.test.js.snap b/src/govuk/components/select/__snapshots__/template.test.js.snap index 4201d35300..49b4576846 100644 --- a/src/govuk/components/select/__snapshots__/template.test.js.snap +++ b/src/govuk/components/select/__snapshots__/template.test.js.snap @@ -9,11 +9,11 @@ exports[`Select when it includes a hint renders the hint 1`] = ` `; exports[`Select when it includes an error message renders with error message 1`] = ` - Error message - +

`; exports[`Select with dependant components renders with label 1`] = ` diff --git a/src/govuk/components/textarea/__snapshots__/template.test.js.snap b/src/govuk/components/textarea/__snapshots__/template.test.js.snap index 0acb285371..d01ab1fe76 100644 --- a/src/govuk/components/textarea/__snapshots__/template.test.js.snap +++ b/src/govuk/components/textarea/__snapshots__/template.test.js.snap @@ -9,11 +9,11 @@ exports[`Textarea when it includes a hint renders with hint 1`] = ` `; exports[`Textarea when it includes an error message renders with error message 1`] = ` - You must provide an explanation - +

`; exports[`Textarea with dependant components renders with label 1`] = `