From fd7af09386f1ecd84de9171c5e7d0b17c4b8ef28 Mon Sep 17 00:00:00 2001 From: "beeps (Kim Grey)" Date: Thu, 20 Jul 2023 15:34:58 +0100 Subject: [PATCH 1/2] Update default EtP button text --- .../govuk/components/exit-this-page/exit-this-page.yaml | 4 ++-- .../src/govuk/components/exit-this-page/template.njk | 8 ++++++-- .../src/govuk/components/exit-this-page/template.test.js | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/govuk-frontend/src/govuk/components/exit-this-page/exit-this-page.yaml b/packages/govuk-frontend/src/govuk/components/exit-this-page/exit-this-page.yaml index 722fb643ab..a55cabf399 100644 --- a/packages/govuk-frontend/src/govuk/components/exit-this-page/exit-this-page.yaml +++ b/packages/govuk-frontend/src/govuk/components/exit-this-page/exit-this-page.yaml @@ -2,11 +2,11 @@ params: - name: text type: string required: false - description: Text for the link. If `html` is provided, the `text` option will be ignored. Defaults to 'Exit this page'. + description: Text for the link. If `html` is provided, the `text` option will be ignored. Defaults to 'Emergency Exit this page' with 'Emergency' visually hidden. - name: html type: string required: false - description: HTML for the link. If `html` is provided, the `text` option will be ignored. + description: HTML for the link. If `html` is provided, the `text` option will be ignored. Defaults to 'Emergency Exit this page' with 'Emergency' visually hidden. - name: redirectUrl type: string required: false diff --git a/packages/govuk-frontend/src/govuk/components/exit-this-page/template.njk b/packages/govuk-frontend/src/govuk/components/exit-this-page/template.njk index a4d458335a..6f3e57637d 100644 --- a/packages/govuk-frontend/src/govuk/components/exit-this-page/template.njk +++ b/packages/govuk-frontend/src/govuk/components/exit-this-page/template.njk @@ -1,5 +1,9 @@ {% from "../button/macro.njk" import govukButton -%} +{% set defaultHtml -%} + Emergency Exit this page +{%- endset -%} +
{{- govukButton({ - html: params.html, - text: params.text | default("Exit this page"), + html: params.html if (params.html or params.text) else defaultHtml, + text: params.text, classes: "govuk-button--warning govuk-exit-this-page__button govuk-js-exit-this-page-button", href: params.redirectUrl | default("https://www.bbc.co.uk/weather") }) -}} diff --git a/packages/govuk-frontend/src/govuk/components/exit-this-page/template.test.js b/packages/govuk-frontend/src/govuk/components/exit-this-page/template.test.js index 3a2b7c9333..c28e4d3348 100644 --- a/packages/govuk-frontend/src/govuk/components/exit-this-page/template.test.js +++ b/packages/govuk-frontend/src/govuk/components/exit-this-page/template.test.js @@ -14,7 +14,7 @@ describe('Exit this page', () => { const $button = $('.govuk-exit-this-page').find('.govuk-button') expect($button.hasClass('govuk-button--warning')).toBeTruthy() - expect($button.text()).toContain('Exit this page') + expect($button.html()).toContain('Emergency Exit this page') expect($button.attr('href')).toBe('/full-page-examples/announcements') }) }) From a0a59ac06684f8bacf4d9b422537a1342d09ca89 Mon Sep 17 00:00:00 2001 From: "beeps (Kim Grey)" Date: Thu, 27 Jul 2023 18:25:14 +0100 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bdee8d6a99..7dad994f15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -287,6 +287,21 @@ You don't need to change anything if you're using the `govukPagination` Nunjucks This change was introduced in [pull request #3899: Update default `aria-label` in Pagination component](https://github.com/alphagov/govuk-frontend/pull/3899). +#### Update the Exit this Page button's default text + +The default text of the Exit this Page button has been updated to indicate that the button is a safety tool and not a generic method of leaving the current page. If you are using the component's default label, you may wish to update it to the new value. + +```diff + +- Exit this page ++ Emergency Exit this page + +``` + +You don't need to change anything if you're using the `govukExitThisPage` Nunjucks macro. + +This change was introduced in [pull request #3989: Update default Exit This Page button text](https://github.com/alphagov/govuk-frontend/pull/3989). + ### Fixes We’ve made fixes to GOV.UK Frontend in the following pull requests: