Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Associate menu button with nav element in header
The menu button is currently associated with the list inside the menu's navigation element through the use of `aria-controls`. However, it's really the navigation itself that is being controlled, so it makes more sense to apply the `navigation` id to the nav than the list. Because of the way the JavaScript uses aria-controls to find the toggled element, this also means that the `govuk-header__navigation--open` modifier class is being applied to the `<nav>`, so we also need to move the `govuk-header__navigation` and any `navigationClasses` passed to the component's macro to the `<nav>`. Because we're now toggling the visibility of the navigation region itself, rather than the list within it, this also avoids having an empty nav region present on the page when on a mobile viewport with the menu closed. Add a new `govuk-header__navigation-list` class to the list, and move the CSS required to reset the default user-agent list styles to this new class. The margins can be simplified slightly – there was previously a `margin: 0` in the same ruleset as the call to `govuk-responsive-margin` which meant that the margin was always 0 on mobile and 2 spacing points only on tablet and above, rather than being 'responsive'. The extra margin being applied on tablet also appears to be a mistake, so switch to applying just applying the margin on desktop and above.
- Loading branch information