-
Notifications
You must be signed in to change notification settings - Fork 334
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
[SPIKE] Tudor crown Safari position tweaks #4423
Conversation
📋 StatsFile sizes
Modules
View stats and visualisations on the review app Action run for 058b443 |
@include govuk-typography-responsive($size: 24, $override-line-height: 1); | ||
@include govuk-typography-weight-regular; | ||
display: inline-table; | ||
vertical-align: top; |
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.
Ideally we'd keep vertical-align: baseline;
but it appears 1px lower in Chrome vs. Safari or Firefox
But for now, it's more reliable to use vertical-align: top
with a margin
In future we could tweak font-size: 30px
(or reset to font-size: 0
) to try and solve the variation:
govuk-frontend/packages/govuk-frontend/src/govuk/components/header/_index.scss
Lines 97 to 104 in 88c45d8
// Font size needs to be set on the link so that the box sizing is correct | |
// in Firefox | |
@include govuk-typography-weight-bold; | |
display: inline-block; | |
margin-right: govuk-spacing(2); | |
font-size: 30px; // We don't have a mixin that produces 30px font size | |
line-height: 1; | |
fb22990
to
a0491c7
Compare
@@ -98,7 +113,7 @@ | |||
font-size: 30px; // We don't have a mixin that produces 30px font size | |||
line-height: 1; | |||
|
|||
@include govuk-media-query($from: tablet) { | |||
@include govuk-media-query($from: desktop) { |
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.
@owenatgov Having an parent link with display: inline
didn't help child alignment, but think it's a bug from #2549 where display: inline
was added at tablet size but the product name didn't wrap until desktop
@querkmachine Ah that's fair, I only checked tablet and desktop Hopefully enough of a spike to demonstrate what's possible, or that the SVG points needs snapping to pixels otherwise Firefox is going to go ahead and do it anyway 😣 See #4423 (comment) for "Why does it become inline on desktop?" Do you want me to hand back over to you or shall I answer the other questions? |
@colinrotherham I've updated #4297 with a tweaked SVG that snaps some of those errant .005px coordinates to their full number. At a glance, the lockup appears to be rendering in the right position on Firefox and iOS Safari and 1px lower than the product name in Chrome and macOS Safari. Can you corroborate that that's what you see too? |
Sorry for the delay @querkmachine Yeah, for the GOV.UK part it's exactly as you said, 1px too low in Chrome and macOS Safari now. Taking just the Product Name text though, it's perfectly v-aligned in Chrome, Firefox and Safari I think we should go back to it just being Firefox misaligned and apply the CSS hack |
- Add new GOV.UK logo lockup with Tudor crown and integrated GOV.UK text - Removes HTML and classes that used to wrap the logo group as these are no longer needed - Adjust the vertical offset of the logo to align with productName text - Tweak attributes to ensure logo is available to assistive technologies
83129b1
to
b8c834a
Compare
a0491c7
to
66c8de1
Compare
66c8de1
to
59289a0
Compare
@querkmachine Mind taking another look? The new SVGs have definitely helped as has using a single compound path |
When switching between services with different crowns we should exactly vertically align the GOV.UK text
We use the logotype SVG for bold “GOV.UK” instead
558aec9
to
23ecd56
Compare
23ecd56
to
75478e6
Compare
Fixed by adding `vertical-align: top` but uses margin to restore the gap underneath the logo when long product names wrap below
Firefox appears to calculate the baseline differently This fix uses an offset of `- 0.5px` to fix both `@1x` and `@2x` displays
At tablet sizes and up, the `govuk-header__logo` element rendered at `30.5px` height (or `30.25px` on high DPI displays) due to line-height of empty space previously occupied by GOV.UK text
75478e6
to
43caf1c
Compare
The link was given `display: inline` at tablet sizes but the product name doesn’t wrap until desktop: #2549
43caf1c
to
058b443
Compare
Spike for #4297 to fix vertical alignment (Header product name) in Safari #4297 (review)
This PR aligns Chrome and Safari again
Original GOV.UK text
Branch
main
renders the GOV.UK text and product name 1px too low in Firefoxhttps://govuk-frontend-review.herokuapp.com/components/header/full-width-with-navigation/preview
Using DPI
@1x
Using DPI
@2x
Note: We see Safari and Chrome baseline differences using
@2x
versus@1x
GOV.UK text as SVG
PR #4297 renders the product name 1px too high in Chrome and Safari:
https://govuk-frontend-pr-4297.herokuapp.com/components/header/full-width-with-navigation/preview
Using DPI
@1x
Using DPI
@2x
Note: We see Safari and Chrome baseline differences using
@2x
versus@1x
but the SVG text is unaffectedGOV.UK text as SVG with position tweaks
PR #4423 (this spike) is correctly aligned:
https://govuk-frontend-pr-4423.herokuapp.com/components/header/full-width-with-navigation/preview
There's also a workaround included for Firefox where the text baseline is calculated 1px lower (or 0.5px at
@2x
DPI) than other browsers, breaking alignment with the product name. This could be "fixed" in Firefox with:Firefox also appeared to have issues with some HiDPI resolutions where the top and bottom parts of the Crown (and the GOV.UK text) could subtly move apart as they round to pixel values but this was fixed in fe6f75b
Related Firefox issues regarding SVG rendering accuracy: