-
Notifications
You must be signed in to change notification settings - Fork 338
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
Fix mobile product name being misaligned in new type scale #4855
Conversation
📋 StatsFile sizes
Modules
View stats and visualisations on the review app Action run for a3326cf |
Other changes to npm packagediff --git a/packages/govuk-frontend/dist/govuk/components/header/_index.scss b/packages/govuk-frontend/dist/govuk/components/header/_index.scss
index de025ff07..858595250 100644
--- a/packages/govuk-frontend/dist/govuk/components/header/_index.scss
+++ b/packages/govuk-frontend/dist/govuk/components/header/_index.scss
@@ -64,7 +64,7 @@
}
.govuk-header__product-name {
- $product-name-offset: 10px;
+ $product-name-offset: if($govuk-new-typography-scale, 7px, 10px);
$product-name-offset-tablet: 5px;
@include govuk-font-size($size: 24, $line-height: 1);
Action run for a3326cf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff. I had a go at trying to make this dynamic but it seems non-trivial enough to not be worth it right now. There probably is a way using the height of the text and the header but because this isn't at the baseline of the SVG itself but a little above to align with the text, it's a pain. This is probably the least complex solution.
…cale Fix mobile product name being misaligned in new type scale
Intended to be a 'quick fix' of the most visible issue mentioned in #4841. There are still potential alignment issues documented below.
Changes
margin-top
of the product name on the mobile breakpoint, if the new type scale is being used.Screenshots
(All screenshots are in Chromium.)
This change principally aims to fix the middle row here ("Mobile") although it does have repercussions on the narrow mobile view too, as the product name appears slightly higher than previously, which may be undesirable.
(Note that the logo and product name always link to the same place, so proximity to one another shouldn't be a problem regarding accessibility.)
Thoughts
In typically frustrating fashion, each browser and screen has a slightly different interpretation of how to align the product name with respect to the logo depending on our dreaded foe, subpixel rounding.
The baseline misalignment between GOV.UK logo and product name on my screens appears to be:
(3024×1964, 254 ppi)
(2560×1440, 123 ppi)
I'm not sure how much pixel nudging we're up to doing to try and minimise the difference between browsers. Experience would tell me that getting it dead-on everywhere is liable to become a caper. That's why this PR only really aims to fix the immediate "this is just way off" alignment issue, rather than fix it in all circumstances.
Todo
Add changelog.