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

Fix footer alignment with grid classes #2428

Closed
wants to merge 7 commits into from

Conversation

lfdebrux
Copy link
Member

@lfdebrux lfdebrux commented Nov 10, 2021

Fixes #1539. It also partly addresses #1726, along with #2446

Unfortunately this PR does not fix any of the other bugs reported in #1680

What

Adjust the styles of the footer layout to better match up with the grid classes. The screenshot below shows the grid classes and the footer not aligning properly:

mac-chrome-left-before

Note: It's worth comparing and contrasting these changes with those in branch nickcolley-ldeb-spike-footer-grid, which achieves much the same effect with fewer lines and fewer commits by using CSS grids. The CSS grid version also behaves slightly better as the viewport changes size. However, CSS grids are not supported by all browsers we want to support, so I think this PR that uses flexbox should take precedence.

Browsers to test in:

  • Internet Explorer 8
  • Internet Explorer 9
  • Internet Explorer 10
  • Internet Explorer 11
  • Chrome on macOS
  • Safari on macOS
  • Chrome on Windows
  • Firefox on macOS
  • Edge on Windows
  • Firefox on Windows
  • Safari on iOS
  • Chrome on iOS
  • Chrome on Android
  • Samsung Internet on Android

For each browser, test the two main footer examples:

and zoom in to 400%.

Screenshots

Note: this is just a sample of screenshots where the change is most visible

IE8 GOV.UK example - Before vs After

ie8-govuk-before

ie8-govuk-after

IE8 Two Column Left example - Before vs After

ie8-left-before

ie8-left-after

IE8 Two Column Right example - Before vs After

ie8-right-before

ie8-right-after

IE8 Equal Three Column example - Before vs After

ie8-three-before

ie8-three-after

IE10 Two Column Right example - Before vs After

ie10-right-before

ie10-right-after

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2428 November 10, 2021 11:16 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2428 November 10, 2021 12:04 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2428 November 26, 2021 15:17 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2428 November 26, 2021 16:06 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2428 November 26, 2021 16:12 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2428 November 26, 2021 16:14 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2428 November 29, 2021 10:10 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2428 November 29, 2021 11:28 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2428 November 29, 2021 11:34 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2428 November 29, 2021 13:15 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2428 November 29, 2021 13:41 Inactive
This commit moves the column modifier (`govuk-footer__list--columns-{{ nav.columns }}`)
to the footer section instead (`govuk-footer__section--span-{{ nav.columns }}`)

This is so that the number of columns influences how far the overall section spans the grid.
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2428 November 29, 2021 14:09 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2428 November 29, 2021 14:18 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2428 November 29, 2021 14:27 Inactive
lfdebrux and others added 5 commits November 29, 2021 14:28
Based on [[1]], we can't use grid autoplacement in any version of
Internet Explorer, so we have to go back to flexbox.  We need to use
border-box sizing and padding to make the gutter work the way we want,
instead of using margins.

[1]: https://css-tricks.com/css-grid-in-ie-faking-an-auto-placement-grid-with-gaps/

This also lets us support the (old) GOV.UK footer layout, where there were
two rows, one with a single 2 column section that took 2/3rds of the
space (followed by empty space), and a second with a 2
column section and a 1 column section. Having `flex-grow` would mean
that the 2 column section in the first row would take up all the space.

This is also closer to what the grid layout does out of the box, so
that's also good.

Note: we're using `width` instead of `flex-basis` to support IE11

See [flexbug #7] for more details on why this is
needed.

flexbug #7: https://github.com/philipwalton/flexbugs#flexbug-7
We want the footer to switch from a multi-section
multi-column affair, to a one-section-per-row single-column-per-section
layout on mobile.

This commit adds a media query so that the switch
happens at the tablet breakpoint.

However, there's lots of space in between the mobile layout and the
desktop layout for all sorts of responsive designs, which this commit
eschews; so we might want to revisit this.
Adds clearfix and `float: left`, mainly for IE8, which doesn't support
flexbox.

Using this with flexbox is okay, because `display: flex` causes flex
items to ignore floats and clears [[1]].

This makes our footer work even more like our page "grids".

[1]: https://www.w3.org/TR/css-flexbox-1/#flex-containers
The original styling for the footer section has `display: inline-block`.
Given our new styling and the `float` we apply in IE8, this is no longer needed.
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2428 November 29, 2021 14:32 Inactive
The previous implementation had the margin above the list set to 40px on desktop
and 25px on mobile, and the margin below the list set to 30px at all breakpoints.

This commit makes the margins equal - it reduces the top margin to 30px as it was
felt that the 40px made the list too far away from the heading.
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2428 December 1, 2021 11:54 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2428 December 1, 2021 13:42 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2428 December 1, 2021 14:05 Inactive
@vanitabarrett
Copy link
Contributor

Note: this PR changes the behaviour slightly of what happens on screen sizes smaller than desktop. The previous behaviour gradually dropped the width of each column, e.g: from thirds, to halves, to full width. This PR changes that behaviour so it drops straight to full width. This means you can end up with quite a large full width footer on tablet, e.g:

Example - before (tablet)

Screenshot 2021-12-01 at 14 40 21

Example - after (tablet)

Screenshot 2021-12-01 at 14 40 05

We could make a change to drop down to 50% width on tablet. However, this would mean that columns that have perhaps been given more visual importance (see example below of the 'Coronavirus' section in the GOV.UK footer) would in some ways have less importance on tablet as the column below would sit alongside it.

Desktop - Coronavirus column sits on its own row

Screenshot 2021-12-01 at 14 44 39

Tablet - Coronavirus column sits alongside "Services and Information"

Screenshot 2021-12-01 at 14 44 53

@vanitabarrett vanitabarrett marked this pull request as ready for review December 1, 2021 14:50
@vanitabarrett vanitabarrett requested a review from a team December 1, 2021 15:09
@vanitabarrett
Copy link
Contributor

Note: because #2446 builds off the changes made in this PR, I'll add the Changelog entry in #2446 rather than in this PR.

@vanitabarrett vanitabarrett changed the title Fix flexbox footer Fix footer alignment with grid classes Dec 1, 2021
@lfdebrux
Copy link
Member Author

lfdebrux commented Dec 2, 2021

@vanitabarrett

Note: this PR changes the behaviour slightly of what happens on screen sizes smaller than desktop.

Do we need a designer to review this change?

vanitabarrett pushed a commit that referenced this pull request Dec 2, 2021
Add Changelog entries for #2446
and #2428
vanitabarrett pushed a commit that referenced this pull request Dec 2, 2021
Add Changelog entries for #2446
and #2428
vanitabarrett pushed a commit that referenced this pull request Dec 2, 2021
Add Changelog entries for #2446
and #2428
vanitabarrett pushed a commit that referenced this pull request Dec 2, 2021
Add Changelog entries for #2446
and #2428
@vanitabarrett
Copy link
Contributor

Superseded by #2462

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.

Footer layout isn't aligned with content layout
4 participants