See WAI ARIA Pracitices Example Disclosure for Navigation Menus for a full explanation on what makes a menu a Disclosure Menu.
Extends all functionality for the BaseMenu class.
All Parameters must be contained in a single object.
| Paramter | Description | Type | Required | Default Value |
|---|---|---|---|---|
| menuElement | The menu element in the DOM. | HTMLElement | true | undefined |
| menuItemSelector | The CSS selector string for menu items. | string | false | "li" |
| menuLinkSelector | The CSS selector string for menu links. | string | false | "a" |
| submenuItemSelector | The CSS selector string for menu items containing submenus. | string | false | "" |
| submenuToggleSelector | The CSS selector string for submenu toggle buttons/links. | string | false | "a" |
| submenuSelector | The CSS selector string for submenus. | string | false | "ul" |
| controllerElement | The element controlling the menu in the DOM. | HTMLElement|null | false | null |
| containerElement | The element containing the menu in the DOM. | HTMLElement|null | false | null |
| openClass | The class to apply when a menu is "open". | string|string[]|null | false | "show" |
| closeClass | The class to apply when a menu is "closed". | string|string[]|null | false | "hide" |
| isTopLevel | A flag to mark the root menu. | boolean | false | false |
| parentMenu | The parent menu to this menu. | DisclosureMenu|null | false | null |
| isHoverable | A flag to allow hover events on the menu. | boolean | false | false |
| hoverDelay | The delay for closing menus if the menu is hoverable (in miliseconds). | number | false | 250 |
See BaseMenu for a list of inherited getters.
See BaseMenu for a list of inherited setters.
See BaseMenu for a list of inherited methods.
The initialize function will run BaseMenu's initialize, as well as sets up the focus, click, hover, keydown, and keyup events through the menu.
Handles keydown events throughout the menu for proper menu use.
This method exists to assit the handleKeyup method.
- Adds all
keydownlisteners listed in BaseMenu. - Adds a
keydownlistener to the menu/all submenus.- Blocks propagation on the following keys: "ArrowUp", "ArrowRight", "ArrowDown", "ArrowLeft", "Home", "End", "Space", "Enter", and "Escape".
Handles keyup events throughout the menu for proper menu use.
- Adds all
keyuplisteners listed in BaseMenu.
The following keybinding explanations are taken from the WAI ARIA Pracitices Example Disclosure for Navigation Menus:
| Key | Function |
|---|---|
| Tab or Shift + Tab | Move keyboard focus among top-level buttons, and if a dropdown is open, into and through links in the dropdown. |
| Space or Enter |
|
| Escape | If a dropdown is open, closes it and sets focus on the button that controls that dropdown. |
| Down Arrow or Right Arrow (Optional) |
|
| Up Arrow or Left Arrow (Optional) |
|
| Home (Optional) |
|
| End (Optional) |
|
Focus the menu's next child.
Unlike BaseMenu, if the currently focussed child in the menu is the last child this method will do nothing.
Focus the menu's last child.
Unlike BaseMenu, if the currently focussed child in the menu is the first child this method will do nothing.