Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require only 1 image for royal coat of arms #3873

Closed
wants to merge 2 commits into from
Closed

Require only 1 image for royal coat of arms #3873

wants to merge 2 commits into from

Conversation

paulrobertlloyd
Copy link
Contributor

@paulrobertlloyd paulrobertlloyd commented Jun 29, 2023

Currently there are 2 versions of the royal coat of arms for single and double pixel density screens, the different images served based on a resolution media query. My belief is that this implementation was chosen as IE8 didn’t support the background-size property in CSS.

With IE8 support being dropped, it’s now possible to have a 2x image, and use background-size to scale it down by half.

As this is the last place the govuk-device-pixel-ratio() mixin is used, I have deprecated this helper.

I’ve also further optimised the large govuk-crest.png image. Currently it is 8,884 bytes, the version included in this PR is 8,365 7,624 bytes.

Sidenote: I tried using an SVG, but given the complexity of the image, this results in a much larger file size.

@colinrotherham colinrotherham added awaiting triage Needs triaging by team sass / css footer and removed awaiting triage Needs triaging by team labels Jun 29, 2023
background-image: govuk-image-url("govuk-crest.png");
@include govuk-device-pixel-ratio {
Copy link
Contributor

Choose a reason for hiding this comment

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

I've had a reminder from @36degrees that other service teams likely use govuk-device-pixel-ratio() so we'll need to stick with our Deprecating a Sass function or mixin notes to avoid a surprise breaking change

But love that we don't need this now 😊

To help manage that change we can either:

  1. Keep the mixin but add @deprecated with a CHANGELOG entry in this PR
  2. Keep the mixin but write up a separate GitHub issue to deprecate it in future

Copy link
Contributor Author

@paulrobertlloyd paulrobertlloyd Jun 29, 2023

Choose a reason for hiding this comment

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

Happy to deprecate this prior to later removal. Given impending v5.0 release, is there an opportunity to deprecate in a prior 4.x release, and remove in v5.0?

If so, I can create a separate issue to remove this mixin and attach it to the 5.0 milestone.

Copy link
Contributor

Choose a reason for hiding this comment

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

We've done a "last" (v4.6) release already and next "last last" (v4.7) we'd like to freeze by tomorrow at 5pm. But if you're up for it we can try and take a quick deprecation-only PR against support/4.x branch?

It's a bit of a stretch as time's against us but we massively appreciate the contribution

Alternatively we can deprecate in v5.0 and remove in v5.1 instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

As an example, you can see how we deprecated govuk-not-ie8() on support/4.x but added new private versions too. Means we could continue using them (internally) until ready to remove entirely:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Challenge accepted! #3877

@colinrotherham
Copy link
Contributor

Thanks @paulrobertlloyd 🙌

Love a good opportunity to remove things

Would you mind splitting out the Allow Crown copyright notice to be removed side of things into another PR? Just to let us consider anything copyright/legal related separately

I've leave the Design System squad to have a closer look

@paulrobertlloyd paulrobertlloyd changed the title Update Crown copyright image and allow removal Require only 1 image for royal coat of arms Jun 29, 2023
As background-size is supported by IE9, we no longer need to provide a different crest image based on device pixels
@paulrobertlloyd
Copy link
Contributor Author

Would you mind splitting out the Allow Crown copyright notice to be removed side of things into another PR? Just to let us consider anything copyright/legal related separately

Split into a separate PR, #3876

@querkmachine
Copy link
Member

To be a little contrarian, I think there's still value in us having 1x and 2x versions of the graphic.

The different scales exist for more than just legacy IE support—although that certainly helped—but to account for screens of different pixel densities. Although 2x (or even 3x and 4x) pixel densities are common on mid- and high-end smartphones and laptops nowadays, the 1x density is still pretty common, especially on desktop PCs.

Even the not-particularly-cheap, not-particularly-old external monitor I use at home is low enough pixel density to still use the 1x image.

If we remove the 1x image, we're forcing all devices to download and use the larger image, even if there is no benefit to it doing so. Even though this is only a few kilobytes per load (caching notwithstanding), that feels like it would build up to a lot of unnecessary data usage quite quickly. (Unfortunately device pixel density isn't something GOV.UK collects as part of its analytics, so it's only possible to estimate based on generalisations.)

Personally, I don't think this change serves a need for users, for the environment, or for the data bills of our servers and users.

@colinrotherham
Copy link
Contributor

As a bit of related info, we could still remove govuk-device-pixel-ratio() in a future PR

Autoprefixer handles min-resolution now so we wouldn't need a mixin for browser support prefixes

Input

@media (min-resolution: 2dppx) {}

Autoprefixer defaults

@media (-webkit-min-device-pixel-ratio: 2),
  (-o-min-device-pixel-ratio: 2/1),
  (min-resolution: 2dppx) {}

Autoprefixer using .browserslistrc

@media (-webkit-min-device-pixel-ratio: 2),
  (min-resolution: 2dppx) {}

@querkmachine
Copy link
Member

Hi @paulrobertlloyd,

I'm going to close this PR. There are whispers coming through the grapevine that the Royal Arms here might be receiving an update soon(ish, maybe), so we might revisit this work at that time.

Sorry for having this sit around for so long just to say 'not yet'!

@paulrobertlloyd
Copy link
Contributor Author

@Beeps Makes sense, and thanks for the update. Quietly hoping the revised coat of arms are simplified to the extent that they can be saved as an SVG file that’s smaller than a PNG. Probably not, but that’d solve a whole number of issues! 🤞

@paulrobertlloyd paulrobertlloyd deleted the footer-copyright branch April 16, 2024 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants