From c509fb14c81a489817525f0500044fabf7c0bbad Mon Sep 17 00:00:00 2001 From: Max Lehmann Date: Tue, 3 Dec 2019 08:12:28 +0000 Subject: [PATCH 1/7] Fix colours on focus state for links from gems --- app/assets/stylesheets/application.scss | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index b7050d226..6a5224aa5 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -47,3 +47,15 @@ $govuk-typography-use-rem: false; @import 'views/answer'; @import 'views/help-page'; @import "views/guide"; + +// TODO: This style overrides one coming from govuk-template +// which turns the focused text colour blue instead of the expected black +// on all components with a global 'a:link:focus' declaration. It should +// be removed when govuk-template is no longer used. + +a[class^="gem-c-"] { + &:focus { + color: $govuk-focus-text-colour !important; + text-decoration: none; + } +} From 50eaf9595c34c7d8bbf88890e66ef03d069d1ab5 Mon Sep 17 00:00:00 2001 From: Max Lehmann Date: Tue, 3 Dec 2019 09:21:03 +0000 Subject: [PATCH 2/7] Extend coverage of gem focus fix --- app/assets/stylesheets/application.scss | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 6a5224aa5..76379fb59 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -53,7 +53,9 @@ $govuk-typography-use-rem: false; // on all components with a global 'a:link:focus' declaration. It should // be removed when govuk-template is no longer used. -a[class^="gem-c-"] { +a[class^="gem-c-"], +*[class^="gem-c-"] a + { &:focus { color: $govuk-focus-text-colour !important; text-decoration: none; From 8c9f40c279acd11cfb012aa09f4f1e329f2b2d12 Mon Sep 17 00:00:00 2001 From: Max Lehmann Date: Tue, 3 Dec 2019 09:22:00 +0000 Subject: [PATCH 3/7] Fix focus colour on content link --- app/assets/stylesheets/components/_back-to-top.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/assets/stylesheets/components/_back-to-top.scss b/app/assets/stylesheets/components/_back-to-top.scss index baf181e0b..0169d4475 100644 --- a/app/assets/stylesheets/components/_back-to-top.scss +++ b/app/assets/stylesheets/components/_back-to-top.scss @@ -4,6 +4,10 @@ margin-left: govuk-spacing(3); margin-right: govuk-spacing(3); + &:focus { + @include govuk-template-link-focus-override; + } + } .app-c-back-to-top__icon { From e35556afbdfaf30b8d8faea51bfce1772ae62387 Mon Sep 17 00:00:00 2001 From: Max Lehmann Date: Tue, 3 Dec 2019 10:14:10 +0000 Subject: [PATCH 4/7] Add govuk-link class to unpublish and gone links --- app/helpers/gone_helper.rb | 2 +- app/views/content_items/unpublishing.html.erb | 2 +- test/helpers/gone_helper_test.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/gone_helper.rb b/app/helpers/gone_helper.rb index e51eb9069..529de7c05 100644 --- a/app/helpers/gone_helper.rb +++ b/app/helpers/gone_helper.rb @@ -1,6 +1,6 @@ module GoneHelper def alternative_path_link(request, alternative_path) alternative_url = File.join(request.protocol, request.host, alternative_path) - link_to(alternative_url, alternative_path) + link_to(alternative_url, alternative_path, class: "govuk-link") end end diff --git a/app/views/content_items/unpublishing.html.erb b/app/views/content_items/unpublishing.html.erb index 375841433..d93b7862c 100644 --- a/app/views/content_items/unpublishing.html.erb +++ b/app/views/content_items/unpublishing.html.erb @@ -10,7 +10,7 @@ <% if @content_item.alternative_url.present? %>

- Visit: <%= link_to(@content_item.alternative_url, @content_item.alternative_url) %> + Visit: <%= link_to(@content_item.alternative_url, @content_item.alternative_url, class: "govuk-link") %>

<% end %> diff --git a/test/helpers/gone_helper_test.rb b/test/helpers/gone_helper_test.rb index bb429fe01..6ef71af57 100644 --- a/test/helpers/gone_helper_test.rb +++ b/test/helpers/gone_helper_test.rb @@ -3,7 +3,7 @@ class GoneHelperTest < ActionView::TestCase test "it renders a link to the full url" do request = stub(protocol: "http://", host: "www.dev.gov.uk") - expected_html = link_to("http://www.dev.gov.uk/government/example", "/government/example") + expected_html = link_to("http://www.dev.gov.uk/government/example", "/government/example", class: "govuk-link") assert_equal(expected_html, alternative_path_link(request, "/government/example")) end end From ee4bdf3f0d02ff2f5e60cae8dd36363403dc038a Mon Sep 17 00:00:00 2001 From: Max Lehmann Date: Tue, 3 Dec 2019 10:37:50 +0000 Subject: [PATCH 5/7] Fix colour of pdf download link --- app/assets/stylesheets/components/_download-link.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/stylesheets/components/_download-link.scss b/app/assets/stylesheets/components/_download-link.scss index fb628ac28..8d5a3ae54 100644 --- a/app/assets/stylesheets/components/_download-link.scss +++ b/app/assets/stylesheets/components/_download-link.scss @@ -5,7 +5,7 @@ margin-bottom: govuk-spacing(3); &:focus { - @include govuk-focused-text; + @include govuk-template-link-focus-override; } @include govuk-media-query($from: tablet) { From a5ce2531ae2038cb184d2d07c2a205ea061cc562 Mon Sep 17 00:00:00 2001 From: Max Lehmann Date: Wed, 4 Dec 2019 09:00:59 +0000 Subject: [PATCH 6/7] Fix white link focus in banners --- app/assets/stylesheets/mixins/_white-links.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/assets/stylesheets/mixins/_white-links.scss b/app/assets/stylesheets/mixins/_white-links.scss index e65590e69..202aba360 100644 --- a/app/assets/stylesheets/mixins/_white-links.scss +++ b/app/assets/stylesheets/mixins/_white-links.scss @@ -6,6 +6,10 @@ text-decoration: underline; } + a:focus { + @include govuk-template-link-focus-override; + } + a:active { color: $govuk-link-active-colour; } From 98ae64d6bafceb376636c30325ba1470d3be5c29 Mon Sep 17 00:00:00 2001 From: Max Lehmann Date: Wed, 4 Dec 2019 11:25:45 +0000 Subject: [PATCH 7/7] Update colours --- app/assets/stylesheets/application.scss | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 76379fb59..544da17cd 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -1,6 +1,5 @@ // The main application stylesheet -$govuk-use-legacy-palette: true; $govuk-typography-use-rem: false; // Components from govuk_publishing_components gem @@ -50,8 +49,8 @@ $govuk-typography-use-rem: false; // TODO: This style overrides one coming from govuk-template // which turns the focused text colour blue instead of the expected black -// on all components with a global 'a:link:focus' declaration. It should -// be removed when govuk-template is no longer used. +// on all components with its global 'a:link:focus' declaration. This +// code should be removed when govuk-template is no longer used. a[class^="gem-c-"], *[class^="gem-c-"] a