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-1159: Prevent JS console error when header element not present + CSS tweak #27

Closed danacotoran closed 1 year ago

danacotoran commented 1 year ago

OLH-1159: Prevent uncaught type error

Currently if someone copies both service-header.js and init-service-header.js from us instead of writing their own JS to conditionally initialise the header in their code, and includes both on every page of their site (including pages which do not contain the OL header), there is a JS error on pages where the header is not present. This fixes that issue.

OLH-1159: slight CSS tweak for service name

Tweak the CSS so that the service name is better spaced in the OL header in the mobile variation in the absence of a service navigational menu. When there is a service nav menu, it should look exactly the same as before. When the nav displays with service name only, the visual spacing should now be more balanced than it was before

Before After
Screenshot 2023-10-20 at 16 43 53 Screenshot 2023-10-20 at 16 43 18

Reminder: focus on src when reviewing as dist is compiled/build files