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

Only default two thirds/one-third layout when footer has two sections #1542

Merged
merged 3 commits into from
Sep 2, 2019

Conversation

NickColley
Copy link
Contributor

@NickColley NickColley commented Aug 28, 2019

This approach is from: http://lea.verou.me/2011/01/styling-children-based-on-their-number-with-css3/

Changes the default layout of two-thirds/one-third only when there's two sections.

The first section can only be also the the 2nd last section (counted backwards) if there's two overall sections.

Screenshots

Before

Before equal columns

After

After equal columns

Improves #1539

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1542 August 28, 2019 16:36 Inactive
@NickColley NickColley changed the title Only default two thirds footer for two sections Only default two thirds/one-third layout when footer has two sections Aug 28, 2019
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1542 August 28, 2019 16:41 Inactive
@NickColley NickColley added this to the Next milestone Aug 28, 2019
Copy link

@ChrisBAshton ChrisBAshton left a comment

Choose a reason for hiding this comment

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

Not heard of the nth-last-child selector before! 😄 left an inline question.

@@ -196,9 +196,9 @@
}
}

// Sections two-third:one-third on desktop
// If the there are only two sections and set the layout to be two-third:one-third on desktop

Choose a reason for hiding this comment

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

Suggested change
// If the there are only two sections and set the layout to be two-third:one-third on desktop
// If there are only two sections, set the layout to be two-third:one-third on desktop

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This reads loads better thanks Chris

@include mq ($from: desktop) {
.govuk-footer__section:first-child {
.govuk-footer__section:first-child:nth-last-child(2) {

This comment was marked as resolved.

This comment was marked as resolved.

This comment was marked as resolved.

This comment was marked as resolved.

This comment was marked as resolved.

Choose a reason for hiding this comment

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

Thanks, this is much better!

@NickColley NickColley force-pushed the only-default-two-thirds-footer-for-two-sections branch from fa14fd9 to 2c089b3 Compare August 29, 2019 09:04
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1542 August 29, 2019 09:04 Inactive
This approach is from: http://lea.verou.me/2011/01/styling-children-based-on-their-number-with-css3/

If you have two sections, then the first section can only be also the the 2nd section (counted backwards) if there's two overall sections.
@NickColley NickColley force-pushed the only-default-two-thirds-footer-for-two-sections branch from 2c089b3 to 490d145 Compare August 29, 2019 09:13
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1542 August 29, 2019 09:13 Inactive
@36degrees
Copy link
Contributor

I think there's still a couple of places where this isn't doing what we want – I think we're hardcoding some logic to try and meet a couple of specific examples (the GOV.UK Footer, three columns and one column) but there's a couple of other scenarios that are breaking the grid too.

For example, if you put the 2-column section on the right, it does not fit with the grid (you end up with a ⅖ column and a ⅗ column:

localhost_3000_components_footer_GOV UK-Flipped_preview (1)

If you have two columns, it should either go to two ½ columns, or two ⅓ columns and a third blank ⅓ column, but at the minute we get two uneven columns:

localhost_3000_components_footer_Two-equal-columns_preview

If we have only one column it kind of works as-is as it fills the entire footer, though I question whether there might be cases where a user might want to restrict it to a ⅓ column:

localhost_3000_components_footer_One-column_preview

@36degrees
Copy link
Contributor

I've currently these as examples on top of this branch – would it be useful for me to commit them and push them as something to work from?

@NickColley
Copy link
Contributor Author

@36degrees yes please, we may be able to make use of the column modifier classes that already exist to tighten this up even more.

@NickColley
Copy link
Contributor Author

NickColley commented Aug 29, 2019

Actually I've changed my mind I think those examples look how I'd expect, given the context of a fall page where most layouts are two thirds / one thirds it feels balanced. Having an empty slot feels worse
?

I think to do what you're proposing it'd require extra flags and functionality (perhaps a breaking change), so I think it's worth shipping this work as is.

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1542 August 29, 2019 14:21 Inactive
@36degrees
Copy link
Contributor

Neither of the examples align with the grid – the first example is more like a ⅖ column and a ⅗ column, and the second example is two uneven columns.

@NickColley
Copy link
Contributor Author

I think I know what you're saying, I wonder if it's always been a bit off...

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1542 August 30, 2019 11:54 Inactive
@NickColley
Copy link
Contributor Author

I've pushed up a change that uses CSS Grid instead of Flexbox.

This would mean IE11 would use the fallback layout (simple inline block that does not align with the grid).

Would also be a breaking change since I've moved the modifier...

What do you think?

@NickColley NickColley removed this from the v3.1.0 milestone Aug 30, 2019
@NickColley
Copy link
Contributor Author

I think we can make a small breaking change to sort this properly, so have pushed the main issues around the grid alignment back into the main issue for the next milestone: #1539 (comment)

I will reduce this pull request back to the original intent, so we can ship a small improvement to three column layouts only.

@NickColley NickColley merged commit 4baa661 into master Sep 2, 2019
@NickColley NickColley deleted the only-default-two-thirds-footer-for-two-sections branch September 2, 2019 15:11
@NickColley NickColley mentioned this pull request Sep 2, 2019
lfdebrux added a commit that referenced this pull request Nov 8, 2021
We want the columns in our footers and our grids to align, however
currently they do not in several scenarios.

This commit adds an example with several combinations of grid and footer
layouts to act as a quick visual reference for whether the alignment is
correct or not. The examples were based on a [comment in PR #1542][1].
This should aid in developing a new footer layout.

[1]: #1542 (comment)
frankieroberto pushed a commit to x-govuk/govuk-frontend that referenced this pull request Dec 1, 2021
We want the columns in our footers and our grids to align, however
currently they do not in several scenarios.

This commit adds an example with several combinations of grid and footer
layouts to act as a quick visual reference for whether the alignment is
correct or not. The examples were based on a [comment in PR alphagov#1542][1].
This should aid in developing a new footer layout.

[1]: alphagov#1542 (comment)
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.

4 participants