govuk-one-login / service-header

A header for services using GOV.UK One Login
https://govuk-one-login.github.io/service-header/
6 stars 4 forks source link

OLH-1043: Tweak service nav for 1 link scenario #28

Closed danacotoran closed 10 months ago

danacotoran commented 10 months ago

What

This tweaks the way the nav script works so that dropdown behaviour does not initialise unless at least 2 navigational links are present. Ticket: https://govukverify.atlassian.net/browse/OLH-1043

Why

Some services might have only one service link in the service navigation. In this scenario it does not make sense to collapse navigation into a dropdown in the mobile variant. It was raised as an issue by a service and we agreed to implement it.

Before ("Menu" toggle always appears)

Screenshot 2023-11-09 at 16 53 02

After ("Menu" toggle no longer appears when there is only one service link)

Screenshot 2023-11-09 at 16 50 18

The design for wider screens and the design for the 2+ nav link scenario should remain unchanged.

How to review

Ignore dist because it's all build files.

You can preview the current version of the header by cloning the repo and opening /dist/preview.html in a browser. To change the number of items in the nav, you can modify the navigationItems in src/preview.njk and run npm run build-all before your change is reflected in /dist/preview.html