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 issues with charts and card blocks #4341

Merged
merged 6 commits into from
Oct 25, 2024
Merged

Fix issues with charts and card blocks #4341

merged 6 commits into from
Oct 25, 2024

Conversation

andysellick
Copy link
Contributor

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

What

Fix a variety of issues to do with the charts. Commits:

  • allows chart height to be normal when the chart is normal, restricting a smaller height only to where the chart is in a smaller space and set to minimal
  • fixes a bug where charts in three column layout weren't resizing properly
  • refactors the card block to always have a link, rather than relying on a heading subblock, in order to fix a visual and accessibility issue where links were duplicated and there was no indication that charts/images were links
  • fix the padding on the card to match the padding on similar blue box in the hero
  • enable an option on the chart component to stop the text surrounding the chart from colliding with the edge of the containing element

Why

Arising from design and accessibility reviews.

Visual changes

Fixing the height issue on /landing-page/tasks

Before After
Screenshot 2024-10-25 at 15 44 30 Screenshot 2024-10-25 at 15 43 29

Fixing the resizing problem:

Before After
Screenshot 2024-10-25 at 15 45 22 Screenshot 2024-10-25 at 15 45 35

Refactoring to change from two links to one (hard to tell from the screenshots, easier if you just try it out)

Before After
Screenshot 2024-10-25 at 15 46 49 Screenshot 2024-10-25 at 15 47 04

Fixing the padding on the blue bit of the card block (it's the indentation of the 'Be kinder' heading - the change to the contents list is because I took this screenshot before rebasing)

Before After
Screenshot 2024-10-25 at 15 48 47 Screenshot 2024-10-25 at 15 49 12

Enable padding on the charts - note the change on the 'data table' and 'download chart data' links (dependent on a new gem version containing alphagov/govuk_publishing_components#4342)

Before After
Screenshot 2024-10-25 at 15 51 24 Screenshot 2024-10-25 at 15 51 29

Trello card: https://trello.com/c/VKrLuGvg

@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4341 October 25, 2024 14:53 Inactive
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4341 October 25, 2024 15:29 Inactive
- graphs were being made short everywhere, but should only be short when the minimal option is used, when the graph is in a three column layout
- make the whole row flexbox to avoid mixing grid and flexbox
- set background colour of the cards to dark blue, and the chart to white, to make the heading look like it's filling the available vertical space
- add min-width 0 to the cards to fix the graph not resizing problem
- improve test data
leenagupte and others added 3 commits October 25, 2024 16:37
- assuming that a card always has a heading link
- so easier to split it out as specific attributes than treat it as a subblock, because then we can modify it
- introduce the link_cover_block option, which sets the link class to include a pseudo element that covers the whole card in a single link, removing the need to make minimal charts a link and avoiding having duplicate links
- update the YAML and tests accordingly

Co-authored-by: Andy Sellick <andy.sellick@digital.cabinet-office.gov.uk>
- makes the padding left/right on the card block match the same padding in the hero block text box, as they're both blue boxes with white text
- bring the text around charts in a bit, as they're currently colliding with the edge of their containing element when shown inside a card block
- this option at time of writing isn't available, will be added in alphagov/govuk_publishing_components#4342
- needed to make the charts work again, currently erroring without the minimal link
@govuk-ci govuk-ci temporarily deployed to govuk-frontend-app-pr-4341 October 25, 2024 16:01 Inactive
@andysellick
Copy link
Contributor Author

@leenagupte have bumped the gem so the preview works again. I've visually checked the pages and all my changes seem to be fine, so good to review 👍

Copy link
Contributor

@leenagupte leenagupte left a comment

Choose a reason for hiding this comment

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

Looks good to me! 👍 ✅

I think someone more CSS inclined should look over the style changes.

Copy link
Contributor

@matthillco matthillco left a comment

Choose a reason for hiding this comment

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

Looks good to me, just one question but not a blocker.

display: grid;
grid-template-columns: repeat(3, 1fr);
display: flex;
justify-content: space-between;
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious why this changed from grid to flex? It works fine so I'm happy to approve, just curious.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question. I initially changed it as part of investigating the problem with chart resizing. When I realised that it was equivalent I thought it might be better to keep it all as flexbox, just to avoid mixing the two.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review 👍

@andysellick andysellick merged commit 3dc7e90 into main Oct 25, 2024
12 checks passed
@andysellick andysellick deleted the fix-graphs branch October 25, 2024 17:16
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