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 layout of /government/history and remove use of inline styles #2661

Merged
merged 3 commits into from
Jan 16, 2023

Conversation

kevindew
Copy link
Member

Trello: https://trello.com/c/lxxx5XLZ/178-govuk-has-a-half-implemented-content-security-policy-csp

The changes here have been made in order for this application to be compatible with the changes coming in alphagov/govuk_app_config#279, where inline styles will no longer be permitted. The scope grew a little to do a bit of a clean-up in the history pages where inline styles were present.

This change:

  • removes classes that have no effect
  • fixes a layout bug
  • replaces inline styles with a class

The layout bug is demonstrated below

Before:

Screenshot 2023-01-13 at 18 25 12

After:

Screenshot 2023-01-13 at 18 31 42


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

Follow these steps if you are doing a Rails upgrade.

These class names don't have any effect (they are not associated with
styles or scripts). I assume these are artefacts from the Whitehall ->
Government Frontend migration.
This layout was broken because the figure element margins led to it
exceeding it's allocated width.

I opted to use a design system override class to resolve this as they
seemed to be the precedent for managing the styles on this page.
The usage of inline styles is going to be disallowed at the CSP level
to reduce the damage HTML injection can do [1].

This replaces the usages of these inline styles with Design System
override classes. I went for these rather than creating a new class as
there didn't seem to be any precedent for specific classes for this part
of the site, yet a variety of precedence in using override classes.

[1]: alphagov/govuk_app_config#279
@govuk-ci govuk-ci temporarily deployed to government-frontend-pr-2661 January 13, 2023 18:32 Inactive
Copy link
Contributor

@patrickpatrickpatrick patrickpatrickpatrick left a comment

Choose a reason for hiding this comment

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

Have compared all the pages that are changed here to live pages and there doesn't appear to be any styling discrepancies on desktop and mobile.

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.

3 participants