Skip to content

Header updates - breaking changes #1058

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 125 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 107 commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
fd5d82e
Remove hardcoded Home link from navigation
frankieroberto Jul 17, 2024
1d564ed
Add 'Home' to examples
frankieroberto Jul 17, 2024
010afb0
Use single path for NHS logo in header
paulrobertlloyd Oct 9, 2024
f24cdf3
Update CHANGELOG with updated SVG logo
paulrobertlloyd Oct 9, 2024
95d5aa6
Update SVG in README for header component
paulrobertlloyd Oct 9, 2024
8499270
Format header styles with Prettier
paulrobertlloyd Oct 9, 2024
f4c1c93
Simplify template logic for header component
paulrobertlloyd Aug 19, 2024
9c192c7
Allow transactional service name in header alongside navigation and s…
paulrobertlloyd Aug 20, 2024
4fc2b53
Update CHANGELOG.md
paulrobertlloyd Aug 22, 2024
611c2ef
Ensure logo in header appears for print media
paulrobertlloyd Oct 24, 2024
82b4b41
Refactor header styles
paulrobertlloyd Oct 24, 2024
e45d809
Update header README to account for recent markup changes
paulrobertlloyd Oct 24, 2024
64afec5
Update backstop reference images for header component
paulrobertlloyd Oct 24, 2024
a1ee8c1
Remove home link from header navigation
paulrobertlloyd Oct 31, 2024
230bf09
Change primaryLinks to use href and text instead of url and label (#1…
frankieroberto Nov 29, 2024
51b1929
Fix changelog merge
frankieroberto Nov 29, 2024
7b55d10
Fix CHANGELOG
frankieroberto Nov 29, 2024
9c49e84
Actually fix changelog
frankieroberto Nov 29, 2024
d17095e
Add changelog item
frankieroberto Nov 29, 2024
46854f9
Merge branch 'main' into header-breaking-changes
frankieroberto Dec 18, 2024
53a7e11
Add current item indicator for header navigation (#1067)
frankieroberto Jan 9, 2025
2097188
Describe the active and current arguments in header (#1098)
frankieroberto Jan 13, 2025
9982244
Update header navigation label (#1073)
paulrobertlloyd Jan 13, 2025
00fe295
Show account information and links in the header (#1063)
paulrobertlloyd Jan 13, 2025
457f00c
tidy header examples
anandamaryon1 Jan 14, 2025
1a2e12b
run prettier on header README
anandamaryon1 Jan 14, 2025
b746e73
Update backstop refernece images
anandamaryon1 Jan 14, 2025
9fc5b2e
Merge branch 'main' into header-breaking-changes
frankieroberto Jan 14, 2025
ed69c88
update changelog
anandamaryon1 Jan 20, 2025
3f60fff
edit account header rbac example placeholder
anandamaryon1 Jan 28, 2025
3310b1e
Merge branch 'main' into header-breaking-changes
frankieroberto Jan 30, 2025
e8fd520
Enable inline styles in tests
frankieroberto Jan 31, 2025
9b32d44
Style fix
frankieroberto Jan 31, 2025
0dfb446
Merge branch 'main' into header-breaking-changes
colinrotherham Feb 13, 2025
c2a1539
Fix Stylelint issues
colinrotherham Feb 13, 2025
a57b40f
Approve minor changes to backstop images
frankieroberto Feb 17, 2025
5713bb3
Merge branch 'main' into header-breaking-changes
colinrotherham Feb 22, 2025
150fea0
Add layout blocks from GOV.UK Frontend
colinrotherham Feb 22, 2025
9b4f3e2
Fix HTML validation moving `<style>` to head
colinrotherham Feb 22, 2025
e046683
Make justification of items in header navigation opt-in
paulrobertlloyd Feb 14, 2025
130909d
Wrap header navigation items when JavaScript is not enabled
paulrobertlloyd Feb 14, 2025
9428747
Add space between header navigation items using padding
paulrobertlloyd Feb 21, 2025
6b99d49
Update backstop images to reflect left aligned navigation in header c…
paulrobertlloyd Mar 13, 2025
55ac87e
Update changelog to reflect left aligned navigation in header component
paulrobertlloyd Feb 14, 2025
423b70b
Merge pull request #1138 from nhsuk/header-navigation-spacing
paulrobertlloyd Mar 13, 2025
4e644b7
Support form submission from header account items
paulrobertlloyd Feb 21, 2025
b1bcf63
Merge pull request #1155 from nhsuk/header-account-buttons
paulrobertlloyd Mar 13, 2025
38c2556
Update CHANGELOG to incluce header account features
paulrobertlloyd Mar 13, 2025
728ce97
Merge branch 'main' into header-breaking-changes
frankieroberto Mar 15, 2025
204cb66
Header breaking changes - update nunjucks params (#1109)
frankieroberto Mar 15, 2025
3d49d16
Ensure templating for header service logo and name is more readable
paulrobertlloyd Mar 15, 2025
50fccc5
Tidy up syntax for header component examples
paulrobertlloyd Mar 15, 2025
d534ba8
Update header backstop images
paulrobertlloyd Mar 15, 2025
5d7c9e1
.nhsuk-header__service-logo is always a link, so don’t need to check …
paulrobertlloyd Mar 15, 2025
9aaeeb5
Remove conditionally added class previously used to left-align naviga…
paulrobertlloyd Mar 15, 2025
e034f23
Merge remote-tracking branch 'origin/main' into header-breaking-changes
anandamaryon1 Mar 27, 2025
27bd75a
fixes from merge, inc. swapping layout.njk to example.njk for header …
anandamaryon1 Mar 27, 2025
bbfb877
update visual test images
anandamaryon1 Mar 27, 2025
26bf31c
Merge branch 'main' into header-breaking-changes
anandamaryon1 Mar 31, 2025
f196a84
Add word-break to account links and buttons to prevent long words fro…
anandamaryon1 Apr 1, 2025
c5cc9ed
Update CHANGELOG.md
anandamaryon1 Apr 2, 2025
30991b9
Update CHANGELOG.md
anandamaryon1 Apr 2, 2025
a9a5e5e
Update CHANGELOG.md
anandamaryon1 Apr 2, 2025
f1f4d48
Update CHANGELOG.md
anandamaryon1 Apr 2, 2025
694ce22
Update CHANGELOG.md
anandamaryon1 Apr 2, 2025
04cf33a
remove self-closing / from img in org header
anandamaryon1 Apr 3, 2025
748f4d2
add overflow wrap to account header item, in addition to links and bu…
anandamaryon1 Apr 7, 2025
37fa2cd
fix header primaryLinks href (from url)
anandamaryon1 Apr 7, 2025
06dd726
tweak account header user icon svg, add file
anandamaryon1 Apr 8, 2025
c806856
tweak account header user icon svg
paulrobertlloyd Apr 8, 2025
549fd02
Move header-specific icon styles into header css. Add flex-shrink to …
anandamaryon1 Apr 10, 2025
8793ac6
Merge branch 'main' into header-breaking-changes
colinrotherham Apr 11, 2025
6362e85
Update reference images
colinrotherham Apr 11, 2025
80dcd0e
Update reference images
colinrotherham Apr 11, 2025
42eab67
Merge branch 'header-calculation' into header-breaking-changes
colinrotherham Apr 15, 2025
801c385
Merge branch 'header-calculation' into header-breaking-changes
colinrotherham Apr 15, 2025
24c5626
Merge branch 'main' into header-breaking-changes
colinrotherham Apr 16, 2025
9d48280
Rename .nhs-logo to .nhsuk-header__logo
paulrobertlloyd Apr 16, 2025
f732aad
Rename .nhsuk-organisation-* to .nhsuk-header__organisation-*
paulrobertlloyd Apr 16, 2025
7830ca5
Rename .nhsuk-header__navigation-item-active-fallback to .nhsuk-heade…
paulrobertlloyd Apr 16, 2025
97351c4
Rename .nhsuk-navigation-container to .nhsuk-header__navigation
paulrobertlloyd Apr 16, 2025
e37e9ab
Rename .nhsuk-navigation to .nhsuk-header__navigation-container
paulrobertlloyd Apr 16, 2025
e02d002
Move .nhsuk-header__drop-down and nhsuk-mobile-menu-container classes…
paulrobertlloyd Apr 16, 2025
3b9e76f
Rename .nhsuk-search__input to .nhsuk-header__search-input and nhsuk-…
paulrobertlloyd Apr 16, 2025
e4d287e
Rename .nhsuk-header--white-nav to nhsuk-header--white-navigation
paulrobertlloyd Apr 16, 2025
f2efb19
Nest contain div element with navigation nav element
paulrobertlloyd Apr 16, 2025
19cce71
Align variables in header.js with updated class names
paulrobertlloyd Apr 16, 2025
293b4d5
Re-order header styles
paulrobertlloyd Apr 16, 2025
a7f27f3
Use hidden attributes instead of classes to manage header menu visibi…
paulrobertlloyd Apr 16, 2025
28717ad
Remove .nhsuk-header__search-wrap container
paulrobertlloyd Apr 16, 2025
81ef524
Use generic search element for header search container
paulrobertlloyd Apr 16, 2025
0c761de
Tidy up header component template
paulrobertlloyd Apr 16, 2025
f93e0d9
Update changelog with new header class names
anandamaryon1 Apr 17, 2025
c4fecb2
Move header specific .nhsuk-icon__chevron-down styles into _header.scss
paulrobertlloyd Apr 17, 2025
b58162f
Remove JS enhancements from example
colinrotherham Apr 17, 2025
bcfcf93
Remove `hidden` from toggle button
colinrotherham Apr 17, 2025
edd49f9
Append menu list after `hidden` attribute
colinrotherham Apr 17, 2025
5bb4d15
Review feedback
colinrotherham Apr 17, 2025
9cf653a
Fix tests to use `hidden` attribute
colinrotherham Apr 17, 2025
b0388c6
Add support for older browsers
colinrotherham Apr 17, 2025
761bd08
Update reference images
colinrotherham Apr 17, 2025
14b1eb1
Set defaults before early return
colinrotherham Apr 22, 2025
2d4da24
Merge pull request #1234 from nhsuk/header-bem
paulrobertlloyd Apr 22, 2025
a8fb776
Merge branch 'main' into header-breaking-changes
colinrotherham Apr 22, 2025
fdcad1b
Update reference images
colinrotherham Apr 22, 2025
57bb80d
Merge branch 'main' into header-breaking-changes
colinrotherham Apr 22, 2025
bae1f52
Merge header variant SASS into single file (#1247)
frankieroberto Apr 22, 2025
b3bc853
Update packages/components/header/README.md
frankieroberto Apr 23, 2025
68e2973
Merge branch 'main' into header-breaking-changes
frankieroberto Apr 23, 2025
24cddac
Merge branch 'main' into header-breaking-changes
colinrotherham Apr 24, 2025
a7f2947
Move header changelog entry to unreleased
colinrotherham Apr 24, 2025
147e8e2
Update macro options for new header
frankieroberto Apr 27, 2025
c611e52
Add search placeholder
colinrotherham Apr 28, 2025
fb466f2
Update base URL description
colinrotherham Apr 28, 2025
bf3ad5e
Merge pull request #1267 from nhsuk/header-breaking-changes-update-ma…
anandamaryon1 Apr 28, 2025
3cc210f
Merge branch 'main' into header-breaking-changes
anandamaryon1 Apr 28, 2025
4c372b1
Update changelog
anandamaryon1 Apr 28, 2025
2cfeebd
Change Health-Z to Health A to Z
frankieroberto Apr 28, 2025
a6e6f5a
Remove leading space
frankieroberto Apr 28, 2025
822f8cc
update changelog, remove snippets and point to service manual instead
anandamaryon1 May 1, 2025
ee2af2b
Merge branch 'main' into header-breaking-changes
colinrotherham May 13, 2025
d136512
Update reference images
colinrotherham May 13, 2025
15388fb
Merge branch 'main' into header-breaking-changes
frankieroberto May 19, 2025
c8966ec
Merge branch 'main' into header-breaking-changes
colinrotherham May 22, 2025
5abb89b
Remove deleted header paths from test
colinrotherham May 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,67 @@ We've made fixes to NHS.UK frontend in the following pull requests:

:new: **New features**

#### Updated header

- Show account information and links in the header ([PR 1063](https://github.com/nhsuk/nhsuk-frontend/pull/1063))
- Support form submission from header account items ([PR 1155](https://github.com/nhsuk/nhsuk-frontend/pull/1155))
- The primary navigation in the header now lets you show which item is the current section or page. ([PR 1067](https://github.com/nhsuk/nhsuk-frontend/pull/1067))
- Update header navigation label from ’Primary navigation’ to ‘Menu’, and remove superfluous `role` and `id` attributes. ([PR 1073](https://github.com/nhsuk/nhsuk-frontend/pull/1073)) To update your HTML, replace:

```html
<nav class="nhsuk-navigation" id="header-navigation" role="navigation" aria-label="Primary navigation">
```

with

```html
<nav class="nhsuk-header__navigation" aria-label="Menu">
```

- Update header navigation to align items to the left. ([PR 1138](https://github.com/nhsuk/nhsuk-frontend/pull/1138)). To restore the previous behaviour, where navigation items appeared evenly spaced out, use the `.nhsuk-header__navigation-list--justified` modifier class:

```html
<ul class="nhsuk-header__navigation-list nhsuk-header__navigation-list--justified">
<li class="nhsuk-header__navigation-item">
<a class="nhsuk-header__navigation-link" href="#">Health A-Z</a>
</li>
...
</ul>
```

If you are using the `.nhsuk-header__navigation-list--left-aligned` modifier class, this can now be removed.

:boom: **Breaking changes**

- Remove the boolean `showNav`, `showSearch`, `transactional` and `transactionalService` options from the header component as respective parts of the header are shown automatically when `primaryLinks` or `search` options are provided.
- Replace the `searchAction` option with the nested `search.action` option
- Replace the `searchInputName` option with the nested `search.name` option

- Update `primaryLinks` in the header to use `text` and `href` instead of `label` and `url` ([PR 1083](https://github.com/nhsuk/nhsuk-frontend/pull/1083))

- We've changed the NHS logo in the header to have higher contrast when focused. ([PR 1047]([https://github.com/nhsuk/nhsuk-frontend/pull/1047]))

If you're not using the Nunjucks macro, locate the SVG code for the existing logo:

```svg
<svg class="nhsuk-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 16" height="40" width="100">
<path class="nhsuk-logo__background" fill="#005eb8" d="M0 0h40v16H0z"></path>
<path class="nhsuk-logo__text" fill="#fff" d="M3.9 1.5h4.4l2.6 9h.1l1.8-9h3.3l-2.8 13H9l-2.7-9h-.1l-1.8 9H1.1M17.3 1.5h3.6l-1 4.9h4L25 1.5h3.5l-2.7 13h-3.5l1.1-5.6h-4.1l-1.2 5.6h-3.4M37.7 4.4c-.7-.3-1.6-.6-2.9-.6-1.4 0-2.5.2-2.5 1.3 0 1.8 5.1 1.2 5.1 5.1 0 3.6-3.3 4.5-6.4 4.5-1.3 0-2.9-.3-4-.7l.8-2.7c.7.4 2.1.7 3.2.7s2.8-.2 2.8-1.5c0-2.1-5.1-1.3-5.1-5 0-3.4 2.9-4.4 5.8-4.4 1.6 0 3.1.2 4 .6"></path>
</svg>
```

Then update it with the following SVG:

```svg
<svg class="nhsuk-header__logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 80" height="40" width="100">
<path fill="currentcolor" d="M200 0v80H0V0h200Zm-27.5 5.5c-14.5 0-29 5-29 22 0 10.2 7.7 13.5 14.7 16.3l.7.3c5.4 2 10.1 3.9 10.1 8.4 0 6.5-8.5 7.5-14 7.5s-12.5-1.5-16-3.5L135 70c5.5 2 13.5 3.5 20 3.5 15.5 0 32-4.5 32-22.5 0-19.5-25.5-16.5-25.5-25.5 0-5.5 5.5-6.5 12.5-6.5a35 35 0 0 1 14.5 3l4-13.5c-4.5-2-12-3-20-3Zm-131 2h-22l-14 65H22l9-45h.5l13.5 45h21.5l14-65H64l-9 45h-.5l-13-45Zm63 0h-18l-13 65h17l6-28H117l-5.5 28H129l13.5-65H125L119.5 32h-20l5-24.5Z"/>
</svg>
```

- Remove hardcoded home link from navigation ([PR 986](https://github.com/nhsuk/nhsuk-frontend/pull/986))
- Header refactor: update CSS classes and BEM naming, use hidden attributes instead of modifier classes, use generic search element ([PR 1234](https://github.com/nhsuk/nhsuk-frontend/pull/1234))
- We've updated the secondary, reverse and warning buttons to use the correct background colour on hover ([PR 908](https://github.com/nhsuk/nhsuk-frontend/pull/908))

#### Include a page template

A Nunjucks page template is now included within the npm package. See [Page template](https://service-manual.nhs.uk/design-system/styles/page-template) for documentation on the supported options.
Expand Down
23 changes: 11 additions & 12 deletions app/components/all.njk
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,27 @@
}) }}

{{ header({
"showNav": "true",
"showSearch": "true",
"search": true,
"primaryLinks": [
{
"url" : "https://www.nhs.uk/conditions",
"label" : "Health A-Z"
href: "https://www.nhs.uk/conditions",
text: "Health A-Z"
},
{
'url' : 'https://www.nhs.uk/live-well/',
'label' : 'Live Well'
href: 'https://www.nhs.uk/live-well/',
text: 'Live Well'
},
{
'url' : 'https://www.nhs.uk/conditions/social-care-and-support/',
'label' : 'Care and support'
href: 'https://www.nhs.uk/conditions/social-care-and-support/',
text: 'Care and support'
},
{
'url' : 'https://www.nhs.uk/news/',
'label' : 'Health news'
href: 'https://www.nhs.uk/news/',
text: 'Health news'
},
{
'url' : 'https://www.nhs.uk/service-search',
'label' : 'Services near you'
href: 'https://www.nhs.uk/service-search',
text: 'Services near you'
}
]
})
Expand Down
45 changes: 45 additions & 0 deletions app/components/header/header-account-logged-in.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{% set title = "Header with account (logged in)" %}
{% from "components/header/macro.njk" import header %}
{% extends 'example.njk' %}

{% block main %}
{{ header({
service: {
text: "Manage patients"
},
account: {
items: [
{
href: "#",
text: "florence.nightingale@nhs.net",
icon: true
},
{
action: "#",
text: "Log out"
}
]
},
primaryLinks: [
{
href: "#",
text: "Home"
},
{
href: "#",
text: "Services"
},
{
href: "#",
text: "Your health"
},
{
href: "#",
text: "Messages"
}, {
href: "#",
text: "Help and support"
}
]
}) }}
{% endblock %}
19 changes: 19 additions & 0 deletions app/components/header/header-account-logged-out.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% set title = "Header with account (logged out)" %}
{% from "components/header/macro.njk" import header %}
{% extends 'example.njk' %}

{% block main %}
{{ header({
service: {
text: "Manage patients"
},
account: {
items: [
{
href: "#",
text: "Log in"
}
]
}
}) }}
{% endblock %}
49 changes: 49 additions & 0 deletions app/components/header/header-account-rbac.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{% set title = "Header with account (logged in, RBAC)" %}
{% from "components/header/macro.njk" import header %}
{% extends 'example.njk' %}

{% block main %}
{{ header({
service: {
text: "Manage patients"
},
search: {
placeholder: "NHS number, date of birth",
visuallyHiddenLabel: "Search for a user"
},
account: {
items: [
{
href: "#",
text: "Florence Nightingale",
icon: true
},
{
text: "RA Manager, Hull and East Yorkshire Hospitals NHS Trust (RWA)"
},
{
href: "#",
text: "Change role"
},
{
action: "#",
text: "Log out"
}
]
},
primaryLinks: [
{
href: "#",
text: "Home"
},
{
href: "#",
text: "Create user"
},
{
href: "#",
text: "Find user"
}
]
}) }}
{% endblock %}
8 changes: 1 addition & 7 deletions app/components/header/header-logo.njk
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,5 @@
{% extends 'example.njk' %}

{% block main %}

{{ header({
"showNav": "false",
"showSearch": "false"
})
}}

{{ header() }}
{% endblock %}
63 changes: 28 additions & 35 deletions app/components/header/header-navigation.njk
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,32 @@
{% block main %}

{{ header({
"showNav": "true",
"showSearch": "false",
"primaryLinks": [
{
"url" : "https://www.nhs.uk/conditions",
"label" : "Health A-Z",
"classes": "app-header__navigation-item--current",
"attributes": {
"aria-current": "true"
}
},
{
'url' : 'https://www.nhs.uk/live-well/',
'label' : 'Live Well'
},
{
'url' : 'https://www.nhs.uk/mental-health/',
'label' : 'Mental health'
},
{
'url' : 'https://www.nhs.uk/conditions/social-care-and-support/',
'label' : 'Care and support'
},
{
'url' : 'https://www.nhs.uk/pregnancy/',
'label' : 'Pregnancy'
},
{
'url' : 'https://www.nhs.uk/nhs-services/',
'label' : 'NHS services'
}
]
})
}}

primaryLinks: [
{
href: "#",
text: "Health A-Z"
},
{
href: "#",
text: "Live Well"
},
{
href: "#",
text: "Mental health"
},
{
href: "#",
text: "Care and support",
active: true
},
{
href: "#",
text: "Pregnancy"
},
{
href: "#",
text: "NHS services"
}
]
}) }}
{% endblock %}
54 changes: 54 additions & 0 deletions app/components/header/header-org-white-account.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{% set title = "Header organisational with white header and account" %}
{% from "components/header/macro.njk" import header %}
{% extends 'example.njk' %}

{% block main %}
{{ header({
classes: "nhsuk-header--white nhsuk-header--white-navigation",
logo: {
href: "#"
},
organisation: {
name: "Anytown Anyplace",
split: "Anywhere",
descriptor: "NHS Foundation Trust"
},
search: {
visuallyHiddenLabel: "Search the Anytown Anyplace Anywhere website"
},
account: {
items: [
{
text: "Florence Nightingale",
icon: true
},
{
action: "#",
text: "Log out"
}
]
},
primaryLinks: [
{
href: "#",
text: "Your hospital visit"
},
{
href: "#",
text: "Wards and departments"
},
{
href: "#",
text: "Conditions and treatments"
},
{
href: "#",
text: "Our people"
},
{
href: "#",
text: "Our research"
}
]
}) }}
{% endblock %}
Loading