diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index b7050d226..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 @@ -47,3 +46,17 @@ $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 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 + { + &:focus { + color: $govuk-focus-text-colour !important; + text-decoration: none; + } +} 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 { 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) { 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; } 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