Skip to content

Commit f7326da

Browse files
Merge pull request #1996 from nhsuk/target-hover-colours
[v10] Update hover colour for task list and pagination
2 parents c5617bd + e44a12b commit f7326da

8 files changed

Lines changed: 63 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ You can still use `nhsuk-print-colour` and `nhsuk-print-hide` but we'll remove t
291291

292292
- [#1942: Update `nhsuk-spacing()` to add missing `$adjustment` and `$important` params](https://github.com/nhsuk/nhsuk-frontend/pull/1942)
293293
- [#1986: Update `nhsuk-font-monospace` font size to better match body text](https://github.com/nhsuk/nhsuk-frontend/pull/1986/changes)
294+
- [#1996: Update hover colour for task list and pagination](https://github.com/nhsuk/nhsuk-frontend/pull/1996)
294295
- [#1997: Preserve conditionally revealed content margins when JavaScript is not supported](https://github.com/nhsuk/nhsuk-frontend/pull/1997)
295296

296297
## 10.5.2 - 8 June 2026

packages/nhsuk-frontend/src/nhsuk/components/pagination/_index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
@include nhsuk-font-size(19);
168168

169169
&:not(:focus):hover {
170-
background-color: nhsuk-colour("grey-4");
170+
background-color: $nhsuk-target-hover-colour;
171171
}
172172
}
173173

packages/nhsuk-frontend/src/nhsuk/components/tables/fixtures.mjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ import { components } from '#lib'
99
*/
1010
export const variants = [
1111
{
12-
options: {
13-
layout: 'background-white'
14-
}
12+
// Regular variant
1513
},
1614
{
1715
description: 'reverse',

packages/nhsuk-frontend/src/nhsuk/components/task-list/_index.scss

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@
1010
/// @link https://github.com/alphagov/govuk-frontend Original code taken from GDS (Government Digital Service)
1111
////
1212

13-
// NHS pages have a grey background, so we need a slightly darker colour for the hover
14-
// This produces 1.1:1 contrast, the same as GOV.UK’s
15-
$nhsuk-task-list-hover-colour: nhsuk-colour-compatible(color.adjust(nhsuk-colour("grey-5"), $lightness: -6%));
13+
$nhsuk-task-list-hover-colour: $nhsuk-target-hover-colour;
14+
$nhsuk-task-list-hover-border-colour: nhsuk-colour("grey-3");
1615

1716
// @deprecated To be removed in v11.0
1817
$nhsuk-task-list-hover-color: $nhsuk-task-list-hover-colour;
@@ -42,20 +41,28 @@ $nhsuk-task-list-hover-color: $nhsuk-task-list-hover-colour;
4241
padding-top: nhsuk-spacing(2) + 4px;
4342
padding-bottom: nhsuk-spacing(2) + 4px;
4443

45-
border-bottom: 1px solid $nhsuk-border-colour;
44+
border: 1px solid $nhsuk-border-colour;
45+
border-width: 0 0 1px;
4646
}
4747

4848
.nhsuk-task-list__item:first-child {
49-
border-top: 1px solid $nhsuk-border-colour;
49+
border-top-width: 1px;
5050
}
5151

5252
// This class is added to the <li> elements where the task name is a link.
5353
// The background hover colour is added to help indicate that the whole row is clickable, rather
5454
// than just the visible link text.
5555
.nhsuk-task-list__item--with-link:hover {
56+
margin-top: -1px;
57+
border-width: 1px 0;
58+
border-color: $nhsuk-task-list-hover-border-colour;
5659
background: $nhsuk-task-list-hover-colour;
5760
}
5861

62+
.nhsuk-task-list__item--with-link:first-child:hover {
63+
margin-top: 0;
64+
}
65+
5966
.nhsuk-task-list__name-and-hint {
6067
display: table-cell;
6168
color: $nhsuk-text-colour;

packages/nhsuk-frontend/src/nhsuk/core/core.unit.test.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ describe('Core', () => {
5656
--nhsuk-reverse-border-colour: #337ec6;
5757
--nhsuk-input-border-colour: #4c6272;
5858
--nhsuk-hover-colour: #aeb7bd;
59+
--nhsuk-reverse-hover-colour: #004b93;
60+
--nhsuk-target-hover-colour: #e0e4e6;
61+
--nhsuk-reverse-target-hover-colour: #0055a6;
5962
--nhsuk-input-background-colour: white;
6063
--nhsuk-code-colour: #d5281b;
6164
--nhsuk-link-colour: #005eb8;

packages/nhsuk-frontend/src/nhsuk/core/settings/_colours-applied.scss

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,31 @@ $nhsuk-input-border-colour: nhsuk-colour("grey-1") !default;
143143

144144
$nhsuk-hover-colour: nhsuk-colour("grey-3") !default;
145145

146+
/// Reverse input hover colour
147+
///
148+
/// Used for hover states on form controls, on reverse backgrounds
149+
///
150+
/// @type Colour
151+
152+
$nhsuk-reverse-hover-colour: nhsuk-shade($nhsuk-brand-colour, 20%) !default;
153+
154+
/// Target area hover colour
155+
///
156+
/// Used for hover states on transparent areas used to expand target areas
157+
///
158+
/// @type Colour
159+
160+
$nhsuk-target-hover-colour: nhsuk-tint(nhsuk-colour("grey-4"), 20%) !default;
161+
162+
/// Reverse target area hover colour
163+
///
164+
/// Used for hover states on transparent areas used to expand target areas,
165+
/// on reverse backgrounds
166+
///
167+
/// @type Colour
168+
169+
$nhsuk-reverse-target-hover-colour: nhsuk-shade($nhsuk-brand-colour, 10%) !default;
170+
146171
/// Form element background colour
147172
///
148173
/// @type Colour

packages/nhsuk-frontend/src/nhsuk/core/tools/_links.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,22 @@
104104
color: VisitedText;
105105
}
106106
}
107+
108+
// Work around SVGs not inheriting color from `:visited` links in Safari
109+
// (https://bugs.webkit.org/show_bug.cgi?id=244025)
110+
&:visited .nhsuk-icon {
111+
fill: $link-visited-colour;
112+
113+
@supports (forced-color-adjust: auto) {
114+
fill: currentcolor;
115+
}
116+
}
117+
118+
&:focus .nhsuk-icon,
119+
&:hover .nhsuk-icon,
120+
&:active .nhsuk-icon {
121+
fill: currentcolor;
122+
}
107123
}
108124

109125
/// Default link hover only styling

packages/nhsuk-frontend/src/nhsuk/core/tools/_shape-arrow.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,19 @@
6060
@if $direction == "up" {
6161
clip-path: polygon(50% 0%, 0% 100%, 100% 100%); // 3
6262
border-width: 0 $perpendicular $height;
63-
border-bottom-color: inherit; // 2
63+
border-bottom-color: currentcolor; // 2
6464
} @else if $direction == "right" {
6565
clip-path: polygon(0% 0%, 100% 50%, 0% 100%); // 3
6666
border-width: $perpendicular 0 $perpendicular $height;
67-
border-left-color: inherit; // 2
67+
border-left-color: currentcolor; // 2
6868
} @else if $direction == "down" {
6969
clip-path: polygon(0% 0%, 50% 100%, 100% 0%); // 3
7070
border-width: $height $perpendicular 0 $perpendicular;
71-
border-top-color: inherit; // 2
71+
border-top-color: currentcolor; // 2
7272
} @else if $direction == "left" {
7373
clip-path: polygon(0% 50%, 100% 100%, 100% 0%); // 3
7474
border-width: $perpendicular $height $perpendicular 0;
75-
border-right-color: inherit; // 2
75+
border-right-color: currentcolor; // 2
7676
} @else {
7777
@error "Invalid arrow direction: expected `up`, `right`, `down` or `left`, got `#{$direction}`";
7878
}

0 commit comments

Comments
 (0)