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 padding on GOV.UK logo affecting hover and focus states #2171

Merged
merged 3 commits into from
Apr 6, 2021

Conversation

36degrees
Copy link
Contributor

@36degrees 36degrees commented Mar 23, 2021

Address two minor issues with the hover and focus states for the GOV.UK logo (including product name, when present):

1. With product name

When the header includes a product name, the homepage link’s underline (on hover) and the focus state take up an additional 10px on the right hand side, because of the 10px right padding on govuk-header__product-name.

Before After
Screenshot 2021-03-23 at 17 20 09 Screenshot 2021-03-23 at 17 20 19
Screenshot 2021-03-23 at 17 20 13 Screenshot 2021-03-23 at 17 20 22

This padding is there to ensure there is a gap left between the product name and the menu button. Remove it, and add a 10px margin to govuk-header__link--homepage instead which achieves the same result but without adding an additional 10px to the hover and focus states.

2. Without product name

When the header does not include a product name, the homepage link’s underline (on hover) and the focus state take up an additional 5px on the right hand side, because of a 5px margin on govuk-header__logotype.

Before After
Screenshot 2021-03-23 at 17 19 17 Screenshot 2021-03-23 at 17 19 33
Screenshot 2021-03-23 at 17 19 42 Screenshot 2021-03-23 at 17 19 37

This margin has been present since the component was added to GOV.UK Frontend, and I believe it’s to ensure there’s a gap between GOV.UK and a product name. Remove this margin when the __logotype element is the last child of its descendent, so that the margin is only included when there is a product name to show.

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2171 March 23, 2021 17:26 Inactive
@36degrees 36degrees changed the title Tidy up GOV.UK logo hover and focus states Fix padding on GOV.UK logo affecting hover and focus states Mar 23, 2021
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2171 March 23, 2021 17:35 Inactive
Copy link
Contributor

@CharlotteDowns CharlotteDowns left a comment

Choose a reason for hiding this comment

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

I really like this change!

The class govuk-header__logo also seems to have some right padding for menu items. Do we know why there was right padding on both the govuk-header__logo and govuk-header__product-name previously, is it for responsive views or another use case?

Copy link
Member

@christopherthomasdesign christopherthomasdesign left a comment

Choose a reason for hiding this comment

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

Checked out and tested locally, all looks good to me!

Copy link
Member

@hannalaakso hannalaakso left a comment

Choose a reason for hiding this comment

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

This is a nicely documented tidy-up @36degrees 👍

However, it seems that there's now some extra margin to the left of the product name when it's on a new line. The GOV.UK text also seems to have slightly moved. Preview.

When the header includes a product name, the homepage link’s underline (on hover) and the focus state take up an additional 10px on the right hand side, because of the 10px right padding on `govuk-header__product-name`.

This padding is there to ensure there is a gap left between the product name and the menu button [1]. Remove it, and add a 10px margin to `govuk-header__link--homepage` instead which achieves the same result but without adding an additional 10px to the hover and focus states.

[1]: df413cf
When the header does not include a product name, the homepage link’s underline (on hover) and the focus state take up an additional 5px on the right hand side, because of a 5px margin on `govuk-header__logotype`.

This margin has been present since the component was added to GOV.UK Frontend, and I believe it’s to ensure there’s a gap between GOV.UK and a product name. Remove this margin when the `__logotype` element is the last child of its descendent, so that the margin is only included when there is a product name to show.
Also, fix formatting to other fixes to match the same formatting used for previous releases, with a colon after the PR number.
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2171 March 30, 2021 08:48 Inactive
@36degrees
Copy link
Contributor Author

@hannalaakso I've changed the approach for the second fix, by removing the margin if the __logotype element is the last child – in which case, there is no product name and so there's no need for the margin.

I think that addresses the issue you raised?

@36degrees 36degrees added this to the v3.12.0 milestone Apr 1, 2021
Copy link
Member

@hannalaakso hannalaakso left a comment

Choose a reason for hiding this comment

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

@36degrees Looks great 🎉 I opened #2181 for the other issues I spotted to do with the product name hover/focus states (nothing to do with the changes in this PR).

@36degrees 36degrees merged commit 311a18d into master Apr 6, 2021
@36degrees 36degrees deleted the header-hover-focus-fixes branch April 6, 2021 10:56
@36degrees 36degrees mentioned this pull request May 13, 2021
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