Skip to content

[v10] Close header menu when clicking or navigating elsewhere#1780

Open
colinrotherham wants to merge 7 commits intoheader-resize-observerfrom
header-auto-close
Open

[v10] Close header menu when clicking or navigating elsewhere#1780
colinrotherham wants to merge 7 commits intoheader-resize-observerfrom
header-auto-close

Conversation

@colinrotherham
Copy link
Contributor

Description

This PR enhances the header component to automatically close when:

  1. Pressing escape
  2. Clicking back or forward
  3. Clicking a header link or button
  4. Submitting the search form

These changes ensure the menu isn't stuck open when a Single Page Application (SPA) swaps page content

Checklist

@colinrotherham colinrotherham added javascript Pull requests that update Javascript code header labels Jan 19, 2026
@colinrotherham colinrotherham temporarily deployed to nhsuk-frontend-pr-1780 January 19, 2026 13:27 Inactive
@colinrotherham colinrotherham self-assigned this Jan 19, 2026
@colinrotherham colinrotherham changed the title Close header menu when clicking or navigating elsewhere [v10] Close header menu when clicking or navigating elsewhere Jan 19, 2026
@sonarqubecloud
Copy link

@anandamaryon1 anandamaryon1 added this to the v10.4.0 milestone Jan 26, 2026
@anandamaryon1
Copy link
Contributor

Tested as much as I can, not having an SPA, works nicely.

Esc key works too, not sure why it's struck out in your list?

@colinrotherham
Copy link
Contributor Author

Esc key works too, not sure why it's struck out in your list?

Ah sorry, because we already shipped it ages ago 😎

@colinrotherham
Copy link
Contributor Author

Thanks 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

header javascript Pull requests that update Javascript code

Projects

Status: Needs review

Development

Successfully merging this pull request may close these issues.

2 participants