Skip to content

Update exit this page overlay colour to use system colours#7183

Open
NickColley wants to merge 1 commit into
mainfrom
fix-exit-this-page-colours
Open

Update exit this page overlay colour to use system colours#7183
NickColley wants to merge 1 commit into
mainfrom
fix-exit-this-page-colours

Conversation

@NickColley

@NickColley NickColley commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

When you press the 'exit this page' button it'll redirect you to a safe page.

Since loading the new page can take a while an overlay is shown that says
'loading'.

Change the colours displayed on this in-between page so they match the browsers default colours (
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/system-color).

GOV.UK Frontend does not set color-scheme with a dark value so these colours will not change to dark automatically, aligning with the existing behaviour.

This decision was made to ensure that there is no clear flash between a light colour and dark colour which could arouse suspicion.

If GOV.UK Frontend supports dark mode in the future this overlay will then support dark colours and a dark page will change to a dark overlay automatically.

Motivation behind this change is ensuring we dont use any hardcoded colours where possible
and rely on functional colours, in this case the appropriate colours are system level.

Browser testing

  • IE 11 (and older browsers) does not execute this JavaScript so the behaviour of the exit button is identical to pressing a regular link.
  • Edge 149 on Windows 11
  • Firefox 151 on Windows 11
  • Chrome 149 on Windows 11
  • Firefox 151 on OSX Golden Gate
  • Chrome 149 on OSX Golden Gate
  • Safari 27 on OSX Golden Gate
  • Safari on iOS v17.3
  • Chrome on iOS v17.3

Older devices

  • Google Chrome on Moto G9 Play v10.0
  • Samsung Internet on Samsung Galaxy S10 v9.0

Closes #7175

TODO: Needs changelog entry

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown

Stylesheets changes to npm package

diff --git a/packages/govuk-frontend/dist/govuk/govuk-frontend.min.css b/packages/govuk-frontend/dist/govuk/govuk-frontend.min.css
index 2e5ab8c44..d97d97671 100644
--- a/packages/govuk-frontend/dist/govuk/govuk-frontend.min.css
+++ b/packages/govuk-frontend/dist/govuk/govuk-frontend.min.css
@@ -3035,7 +3035,8 @@ screen and (forced-colors:active) {
     right: 0;
     bottom: 0;
     left: 0;
-    background-color: #fff
+    color: CanvasText;
+    background-color: Canvas
 }
 
 .govuk-exit-this-page-hide-content * {

Action run for 298d6a9

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown

Other changes to npm package

diff --git a/packages/govuk-frontend/dist/govuk/components/exit-this-page/_mixin.scss b/packages/govuk-frontend/dist/govuk/components/exit-this-page/_mixin.scss
index 2671d2ea5..e0a2961e4 100644
--- a/packages/govuk-frontend/dist/govuk/components/exit-this-page/_mixin.scss
+++ b/packages/govuk-frontend/dist/govuk/components/exit-this-page/_mixin.scss
@@ -69,7 +69,11 @@
     right: 0;
     bottom: 0;
     left: 0;
-    background-color: base.govuk-colour("white");
+    // The overlay is imitating a default browser window so we can use
+    // system colours ensure it matches the browser's default colours.
+    // https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/system-color
+    color: CanvasText;
+    background-color: Canvas;
   }
 
   // This class is added to the body when the Exit This Page button is activated

Action run for 298d6a9

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown

📋 Stats

No changes to any distributed file sizes!


Action run for 298d6a9

@NickColley NickColley force-pushed the fix-exit-this-page-colours branch from 41562ec to ba6bb30 Compare June 17, 2026 11:53
@NickColley NickColley force-pushed the fix-exit-this-page-colours branch from ba6bb30 to 9597112 Compare June 17, 2026 11:58
@NickColley NickColley marked this pull request as ready for review June 17, 2026 12:40
When you press the 'exit this page' button it'll redirect you to a safe page.

Since loading the new page can take a while an overlay is shown that says
'loading'.

Change the colours displayed on this in-between page so they match the browsers
default colours (
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/system-color))

GOV.UK Frontend does not set `color-scheme` with a `dark` value
so these colours will not change to dark automatically, aligning with the existing behaviour.

This decision was made to ensure that there is no clear flash between
a light colour and dark colour which could arouse suspicion.

If GOV.UK Frontend supports dark mode in the future this overlay will then
support dark colours and a dark page will change to a dark overlay automatically.

Motivation behind this change is ensuring we dont use any hardcoded colours where possible
and rely on functional colours, in this case the appropriate colours are system level.

@querkmachine querkmachine left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks gucci to me 👌

@NickColley

Copy link
Copy Markdown
Contributor Author

Blocking myself: Need changelog entry, then merge after 6.3.0 has gone out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Exit this page overlay to use browsers' blank page background

3 participants