Skip to content

Conversation

tombye
Copy link
Contributor

@tombye tombye commented May 30, 2025

Adds the ability to turn on the new GOV.UK branding in emails we send with the GOV.UK branding1

https://trello.com/c/tqglnJkB/1285-update-email-template-with-rebranded-govuk-logo

image

Notes for reviewers

Reviewers should try sending an email with the rebrand keyword arg set to True and False in the API code (see this branch on API). They should also check the email previews you can see when you change email branding in settings on Admin (see this branch on Admin). Please check the version of utils with these changes works:

  • with the existing code in API and Admin
  • with the addition of the rebrand arg, set to False, in API and Admin (should change nothing)
  • with the addition of the rebrand arg, set to True, in API and Admin (should change to the new GOV.UK brand)

Please also read each commit and focus on the logic of the coding changes rather than checking specific rendering differences between email clients or how it is with assistive tech. A lot of work has already been done on those (see comments on the trello card and these visual testing results). You can if you want of course :)

Footnotes

  1. this will also affect emails with a GOV.UK + department logo branding (see https://github.com/alphagov/notifications-manuals/wiki/Email-template-documentation for details

tombye added 3 commits May 29, 2025 11:22
Mainly copies the existing approach while changing
the colours but also:
- adjusts the banner height to match the web
  version
- makes the hovering cyan dot by using font
  families with a circular period character
- juggles around the vertical positioning to
  roughly match the web version, which is kind of
  aligned to the baseline rather than the middle
- removes the table used to render the border at
  the bottom of the banner

This also sets a max-height for the crown image to
fix an issue on Outlook on Android where the image
scaled to its true size rather than that set in
CSS.
Tests with a crown image and real text didn't work
due to Outlook not wanting to allow more space
around the dot or change its vertical position
without affecting the line height in bad ways.

VML was chosen to copy the approach the design
system team took for the web version of the logo,
rewriting it completely in SVG. Support for SVG is
bad across all email clients but VML support in
Outlook is good and we were able to convert the
SVG from the web version to VML with this
convertor tool: https://stylecampaign.com/vml/

That still required the following changes post
conversion:
- all shapes given a white fill
- boolean values set to a single letter ('f' from 'false')
- width and height on the top-level group changed halved (324 to 162, 60 to 30)
- the 'GOV.UK' text added before the VML
- a <v:rect> shape added with fill matching the banner, to cover up the 'GOV.UK' text
- the top-level group moved up 8px via 'top:-8'
- the tables and their cells used to position the logo and text in the <a> tag removed
- the banner height changed from 53px to 60px to match the web version
- padding-left added to the cell containing the <a>
The approach of using VML overlapping real
'GOV.UK' text has a problem if you're navigating
using tabbing, or for a moment when you click on
the logo. When this happens, Outlook inverts the
VML but leaves a gap in this where the text sits.
I can't find a way to prevent this and it looks
broken.

So, after designing a version of the logo in MS
Word and using some of the CSS applied in the HTML
when you export to HTML, I found we can have a
variant of the version we use for other email
clients, where the dot is in a font with a
circular period. This needs to be different enough
in Outlook, because it doesn't support
display: inline-block and needs the custom
mso-text-raise CSS property to position the dot in
the middle of the line, and padding on the parent
cells to align with the crown image.

I also made the following changes in this commit:
- the govuk_bg_colour variable was removed due to
  only being used once now
- stop setting background colour on central cells
  in banner as unnecessary and losing them helps
  print styles remove the banner colour
- tweak to line-height of dot, to get better
  overall position among popular email clients
- aria-label=GOV.UK added to span containing
  'GOV.UK' text to help Voiceover determine an
  accessible name for that part of the banner
@kr8n3r
Copy link
Contributor

kr8n3r commented Jun 2, 2025

  • branding preview works as expected with the flags set to either true or false
  • emails have correct branding based on flag
  • happy with the code

Brings new GOV.UK brand into email template,
behind a flag.
@tombye tombye merged commit a97b36f into main Jun 3, 2025
2 checks passed
@tombye tombye deleted the update-govuk-logo-to-new-brand branch June 3, 2025 13:54
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.

2 participants