diff --git a/src/govuk/components/error-summary/_index.scss b/src/govuk/components/error-summary/_index.scss
index 34e7aa8688..896e5df8c4 100644
--- a/src/govuk/components/error-summary/_index.scss
+++ b/src/govuk/components/error-summary/_index.scss
@@ -20,13 +20,11 @@
@include govuk-responsive-margin(4, "bottom");
}
- .govuk-error-summary__body {
+ .govuk-error-summary__body,
+ .govuk-error-summary__body p {
@include govuk-font($size: 19);
-
- p {
- margin-top: 0;
- @include govuk-responsive-margin(4, "bottom");
- }
+ @include govuk-responsive-margin(4, "bottom");
+ margin-top: 0;
}
// Cross-component class - adjusts styling of list component
diff --git a/src/govuk/components/error-summary/template.njk b/src/govuk/components/error-summary/template.njk
index 0f9ec2f941..d7b950c3fd 100644
--- a/src/govuk/components/error-summary/template.njk
+++ b/src/govuk/components/error-summary/template.njk
@@ -5,13 +5,12 @@
- {% if params.descriptionHtml or params.descriptionText %}
-
+ {% if params.descriptionHtml or params.descriptionText %}
+
{{ params.descriptionHtml | safe if params.descriptionHtml else params.descriptionText }}
- {% endif %}
-
+ {% endif %}
+
{% for item in params.errorList %}
-
{% if item.href %}
@@ -21,6 +20,5 @@
{% endif %}
{% endfor %}
-
-
+
diff --git a/src/govuk/components/error-summary/template.test.js b/src/govuk/components/error-summary/template.test.js
index 5d05fdac79..1d738d355a 100644
--- a/src/govuk/components/error-summary/template.test.js
+++ b/src/govuk/components/error-summary/template.test.js
@@ -64,7 +64,7 @@ describe('Error-summary', () => {
it('renders description text', () => {
const $ = render('error-summary', examples.description)
- const summaryDescription = $('.govuk-error-summary__body p').text().trim()
+ const summaryDescription = $('.govuk-error-summary__body').text().trim()
expect(summaryDescription).toEqual('Lorem ipsum')
})
@@ -72,14 +72,14 @@ describe('Error-summary', () => {
it('allows description text to be passed whilst escaping HTML entities', () => {
const $ = render('error-summary', examples['html as descriptionText'])
- const summaryDescription = $('.govuk-error-summary__body p').html().trim()
+ const summaryDescription = $('.govuk-error-summary__body').html().trim()
expect(summaryDescription).toEqual('See errors below (▼)')
})
it('allows description HTML to be passed un-escaped', () => {
const $ = render('error-summary', examples['description html'])
- const summaryDescription = $('.govuk-error-summary__body p').html().trim()
+ const summaryDescription = $('.govuk-error-summary__body').html().trim()
expect(summaryDescription).toEqual('See