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

docs(cookie banner): align cookie banner content left #957

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

chrispymm
Copy link
Contributor

@chrispymm chrispymm commented Nov 25, 2024

This PR overrides the govuk cookie banner styles to left align the content to match the rest of the site.

It also makes a small adjustment to add the hidden attribute to the banner by default. This ensures the banner stays hidden and is only revealed by the JS if the user needs to accept or reject. This will prevent the "flash of cookie banner" sometimes visible on the site currently, where the banner displays, and is then hidden by the JS when it realises it's not needed.

Before:
image

After:
image

@chrispymm chrispymm requested a review from a team as a code owner November 25, 2024 11:30
Copy link
Contributor

@robertjmccarthy robertjmccarthy left a comment

Choose a reason for hiding this comment

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

Could you look at the width of the cookie content container please? It's wrapping a single word which doesn't look to be wrapping at the same width as the max width of the body container below it.

@chrispymm
Copy link
Contributor Author

chrispymm commented Nov 25, 2024

@robertjmccarthy the tricky thing here is that the cookie banner is just using a 2/3 grid container. This is also why it doesn't line up with the body copy - the lines of text start in a different place, so for a good reading width they will end at different points too.

I don't really want to muck around with the standard width just for one word - the web is responsive and there will always be orphans at some point....

...which is why the css property text-wrap: pretty was introduced recently 🎉 it uses a better (and slightly slower) algorithm for text wrapping specifically to reduce orphans (across all break points)

image

@chrispymm chrispymm merged commit 78e4c9e into main Nov 25, 2024
18 checks passed
@chrispymm chrispymm deleted the left-align-cookie-banner branch November 25, 2024 14:22
@gregtyler
Copy link
Contributor

🎉 This PR is included in version 3.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants