BaseMenuItem
A basic navigation link contained inside of a BaseMenu.
Constructor
Constructs a new BaseMenuItem.
new BaseMenuItem({
menuItemElement,
menuLinkElement,
parentMenu,
isSubmenuItem,
childMenu,
toggle,
});The constructor populates the dom, elements, and submenu properties. It will not initialize the menu item; this is left to the subclasses to evoke.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| options | object | The options for generating the menu item. | undefined |
| options.menuItemElement | HTMLElement | The menu item in the DOM. | undefined |
| options.menuLinkElement | HTMLElement | The menu item's link in the DOM. | undefined |
| options.parentMenu | BaseMenu | The parent menu. | undefined |
| options.isSubmenuItem | boolean | A flag to mark if the menu item is controlling a submenu. | false |
| options.childMenu | BaseMenu, null | The child menu. | null |
| options.toggle | BaseMenuToggle, null | The controller for the child menu. | null |
Initialize
Initialize the menu item.
BaseMenuItem.initialize();This method is a placeholder for subclasses to expand upon. The BaseMenuItem's initialize method does nothing.
Properties
_dom protected
The DOM elements within the menu item.
BaseMenuItem._dom;Type
Object<HTMLElement>
Properties
| Name | Type | Description | Default |
|---|---|---|---|
| item | HTMLElement | The menu item. | null |
| link | HTMLElement | The menu item's link. | null |
_elements protected
The declared accessible-menu elements within the menu item.
BaseMenuItem._elements;Type
Object<BaseMenu, BaseMenuToggle>
Properties
| Name | Type | Description | Default |
|---|---|---|---|
| parentMenu | BaseMenu | The menu containing this menu item. | null |
| childMenu | BaseMenu, null | The menu contained within this menu item. | null |
| toggle | BaseMenuToggle, null | The menu toggle within this menu item that controls the childMenu. | null |
_submenu protected
A flag marking a submenu item.
BaseMenuItem._submenu; // Default: `false`.Type
boolean
Getters and Setters
dom readonly
The DOM elements within the menu item.
BaseMenuItem.dom;See _dom for more information.
elements readonly
The declared accessible-menu elements within the menu item.
BaseMenuItem.elements;See _elements for more information.
isSubmenuItem readonly
A flag marking a submenu item.
BaseMenuItem.isSubmenuItem;See _submenu for more information.
Methods
focus public
Focuses the menu item's link if the parent menu's shouldFocus value is true.
BaseMenuItem.focus();blur public
Blurs the menu item's link if the parent menu's shouldFocus value is true.
BaseMenuItem.blur();