Class ServiceNavigation

Service Navigation component

Hierarchy (view full)

Constructors

Properties

_$root: HTMLElement
$menu: HTMLElement
$menuButton: Element
menuIsOpen: boolean = false

Remember the open/closed state of the nav so we can maintain it when the screen is resized.

mql: MediaQueryList = null

A global const for storing a matchMedia instance which we'll use to detect when a screen size change happens. We rely on it being null if the feature isn't available to initially apply hidden attributes

elementType: (new () => Element) = HTMLElement
moduleName: string = 'govuk-service-navigation'

Name for the component used when initialising using data-module attributes.

Accessors

Methods

  • Private

    Sync menu state

    Uses the global variable menuIsOpen to correctly set the accessible and visual states of the menu and the menu button. Additionally will force the menu to be visible and the menu button to be hidden if the matchMedia is triggered to desktop.

    Returns void