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

Simplify main wrapper spacing logic #1371

Merged
merged 4 commits into from
May 29, 2019
Merged

Simplify main wrapper spacing logic #1371

merged 4 commits into from
May 29, 2019

Conversation

NickColley
Copy link
Contributor

@NickColley NickColley commented May 22, 2019

By using a :first-child selector we can avoid the need for a modifier class, which is often missed.

This also removes the mixins and modifier class, as there's no clear need for these things.

This work would also allow us to simplify the guidance around main wrapper, since the modifier class is no longer needed: https://design-system.service.gov.uk/styles/layout/#page-wrappers

You can compare pages, which used to require the modifier class which no longer do.

Closes #888

Update: I've changed the approach based on the feedback so it's not a breaking change.

It includes deprecations instead tracked by this issue: #1379

We still may want to update the guidance but it might not be as drastic: alphagov/govuk-design-system#887

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1371 May 22, 2019 10:49 Inactive
// </div>


@mixin govuk-main-wrapper {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe I'm being too trigger happy and we should just leave these, I'm just not sure why they're part of the public api.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I'm not sure either…

By the looks of it, I added the mixins in 4c01202 but I've no idea why.


.govuk-main-wrapper--l {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could in theory leave this modifier around, there might be cases where it could be useful?

My reasoning for removing it is, that this modifier should only be applied when the main wrapper is the first child. cc @dashouse is this correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess there might be edge cases where for reasons a service ends up with an empty or non-visible element before the main wrapper? For example, a script tag, or an empty container that's always there even if there's no phase banner / breadcrumbs / whatever.

I think I'd be tempted to keep the class just so that there's an option available in those cases?

Choose a reason for hiding this comment

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

Based on existing implementations of Alerts (alphagov/govuk-design-system-backlog#2) I would second keeping the class

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense to me lets keep it.

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1371 May 22, 2019 10:58 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1371 May 22, 2019 11:05 Inactive
@NickColley NickColley marked this pull request as ready for review May 22, 2019 11:09
@NickColley
Copy link
Contributor Author

We could consider doing this after v3.0.0 and deprecating things rather than adding this as a breaking change, but I figured the risk was low since migration is automatic?

@NickColley NickColley force-pushed the css-only-before-content branch from f452880 to f716608 Compare May 28, 2019 09:40
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1371 May 28, 2019 09:40 Inactive
@NickColley NickColley added this to the v2.12.0 milestone May 28, 2019
@NickColley NickColley changed the base branch from v3 to master May 28, 2019 11:38
@NickColley NickColley changed the base branch from master to v3 May 28, 2019 11:38
@NickColley NickColley modified the milestones: v2.12.0, v3.0.0 May 28, 2019
@NickColley NickColley changed the base branch from v3 to master May 28, 2019 11:39
@NickColley NickColley changed the base branch from master to v3 May 28, 2019 11:40
@NickColley
Copy link
Contributor Author

Could get this into 2.12.0 if we were so inclined...

Copy link
Contributor

@aliuk2012 aliuk2012 left a comment

Choose a reason for hiding this comment

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

👍 I like your approach of deprecating the class name rather than removing it completely. Good spot on the unused mainClasses variable.

We're not sure these are useful, so these will be removed in a future release, if you are using this please let us know.
By using :first-child we can avoid the need for a modifier class, which is often missed.

We may be able to simplify the documentation based on this change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

5 participants