From d5cf3d4fa2ef7998407d2f8343170ad8c22758de Mon Sep 17 00:00:00 2001 From: Nick Colley Date: Thu, 6 Sep 2018 13:36:29 +0100 Subject: [PATCH 1/3] Remove duplication in table headers and cells --- src/components/table/_table.scss | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/table/_table.scss b/src/components/table/_table.scss index e329a254bf..b521e7fb63 100644 --- a/src/components/table/_table.scss +++ b/src/components/table/_table.scss @@ -15,12 +15,9 @@ .govuk-table__header { @include govuk-typography-weight-bold; - - padding: govuk-spacing(2) govuk-spacing(4) govuk-spacing(2) 0; - border-bottom: 1px solid $govuk-border-colour; - text-align: left; } + .govuk-table__header, .govuk-table__cell { padding: govuk-spacing(2) govuk-spacing(4) govuk-spacing(2) 0; border-bottom: 1px solid $govuk-border-colour; From b3726ed461fd4db811bd22b9ca130c67a356313d Mon Sep 17 00:00:00 2001 From: Nick Colley Date: Thu, 6 Sep 2018 13:37:45 +0100 Subject: [PATCH 2/3] Add compatibility override for tables Elements conflict When using Elements and GOV.UK Frontend together, tables behave differently, we need to force the original behaviour of tables to allow for settting the font size on the root element, which is how we recommend users to adjust the font-size of their tables. --- src/components/table/_table.scss | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/table/_table.scss b/src/components/table/_table.scss index b521e7fb63..76ef87739d 100644 --- a/src/components/table/_table.scss +++ b/src/components/table/_table.scss @@ -22,6 +22,12 @@ padding: govuk-spacing(2) govuk-spacing(4) govuk-spacing(2) 0; border-bottom: 1px solid $govuk-border-colour; text-align: left; + // GOV.UK Elements sets the font-size and line-height for all headers and cells + // in tables. + @include govuk-compatibility(govuk_elements) { + font-size: inherit; + line-height: inherit; + } } .govuk-table__cell--numeric { From 2b162c9c13452b25752f406bd9f200fca2d67aad Mon Sep 17 00:00:00 2001 From: Nick Colley Date: Thu, 6 Sep 2018 13:52:41 +0100 Subject: [PATCH 3/3] Add CHANGELOG entry --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae1f2de3af..498be00f85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -125,6 +125,9 @@ ([PR #976](https://github.com/alphagov/govuk-frontend/pull/976)) +- Defend tables against GOV.UK Elements code + ([PR #983](https://github.com/alphagov/govuk-frontend/pull/983)) + - Pull Request Title goes here Description goes here (optional)