From 09a8ac9a56702cd74b6afe652c5537f0d4b5f592 Mon Sep 17 00:00:00 2001 From: Nick Colley Date: Fri, 25 Oct 2019 11:29:04 +0100 Subject: [PATCH 1/2] Only add underline to back link when href exists "Browser default behaviour is to underline anchors only when an href is provided. This is to ensure users can identify links on a page (an anchor without an href is not considered a link by default). This feature also has the side effect of helping developers realise that they may have missed an href attribute - as they can visually see on the page that a link is not underlined." Fixes https://github.com/alphagov/govuk-frontend/issues/1171 --- .../components/back-link/_back-link.scss | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/govuk/components/back-link/_back-link.scss b/src/govuk/components/back-link/_back-link.scss index cef76efe9a..3f4c8563b4 100644 --- a/src/govuk/components/back-link/_back-link.scss +++ b/src/govuk/components/back-link/_back-link.scss @@ -17,7 +17,10 @@ // Allow space for the arrow padding-left: 14px; + } + // Only add a custom underline if the component is linkable + .govuk-back-link[href] { // Use border-bottom rather than text-decoration so that the arrow is // underlined as well. border-bottom: 1px solid govuk-colour("black"); @@ -30,22 +33,22 @@ &:focus { border-bottom-color: transparent; } + } - // Prepend left pointing arrow - &:before { - @include govuk-shape-arrow($direction: left, $base: 10px, $height: 6px); + // Prepend left pointing arrow + .govuk-back-link:before { + @include govuk-shape-arrow($direction: left, $base: 10px, $height: 6px); - content: ""; + content: ""; - // Vertically align with the parent element - position: absolute; + // Vertically align with the parent element + position: absolute; - top: 0; - bottom: 0; - left: 0; + top: 0; + bottom: 0; + left: 0; - margin: auto; - } + margin: auto; } @if $govuk-use-legacy-font { From 27355b328f5080c5955bcc9d2600e74117cd6dd7 Mon Sep 17 00:00:00 2001 From: Nick Colley Date: Fri, 25 Oct 2019 11:31:34 +0100 Subject: [PATCH 2/2] Update CHANGELOG --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1542fe4ab5..5523a15033 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +### Fixes +- [Pull request #1620: Only add underline to back link when href exists ](https://github.com/alphagov/govuk-frontend/pull/1620). + ## 3.3.0 (Feature release) ### New features