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

Masthead component has strange behaviour on zoom in Chrome and Firefox on Mac #245

Closed
vickytnz opened this issue Aug 11, 2024 · 1 comment

Comments

@vickytnz
Copy link

vickytnz commented Aug 11, 2024

I sometimes zoom right out to get a quick screenshot, and from this discovered a strange zoom issue on product pages at 33% zoom on chrome:

image at 33% on Chrome with product area going to a thin column

It isn't a problem on Safari (possibly since I can't zoom out more than 50%) but is even worse on Firefox which has distortions even at 80%

image at 80% on Firefox with product area going to a thin column

It seems to be a problem with display: flex; in the css:

.x-govuk-masthead {
    padding-bottom: 15px;
    background-color: #2288aa;
    color: #ffffff;
     display: flex; 
}

since when I turn that off the formatting is a little spaced out but the zoom problem disappears.

Example in Firefox with display:flex; turned off

This is the CSS i have added as an override to fix it (I think):

/* fixing app header issues - remove if fixed upstream */
.govuk-header__container {
  border-bottom: 11px solid $govuk-brand-colour !important; // random line appears so 1px extra
}

.app-header--no-border {
    border-bottom: 10px solid $govuk-brand-colour !important;
    margin-bottom: 0;
}

.x-govuk-masthead {
  margin-top: -15px !important;
  display: block !important; //fixing flex issue when zoomed out;
}

.x-govuk-masthead > .govuk-width-container .govuk-breadcrumbs{
padding-top: 11px !important; //line up with other parts of the site for breadcrumbs
}

/* end fixing app header issues  */
@vickytnz vickytnz changed the title Product page has strange behaviour at 33% zoom Product page has strange behaviour on zoom in Chrome and Firefox on Mac Aug 11, 2024
@paulrobertlloyd paulrobertlloyd transferred this issue from x-govuk/govuk-eleventy-plugin Aug 23, 2024
@paulrobertlloyd paulrobertlloyd changed the title Product page has strange behaviour on zoom in Chrome and Firefox on Mac Masthead component has strange behaviour on zoom in Chrome and Firefox on Mac Aug 23, 2024
@paulrobertlloyd
Copy link
Contributor

There’s definitely some weird browser bug at play here; in addition to the above, I was able to see how removing the negative margin on a proceeding navigation element would stop the width of the masthead from collapsing.

Have fixed this by removing flex layout, and using an old-school method of preventing margin collapse by setting the top padding to 0.1px 🙃. Browsers!

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

No branches or pull requests

2 participants