Skip to main content

ElementMenu

Namespace for constructing menu bars

Index

Functions

_KeyDown

  • _KeyDown(...this, ev): Promise<void>
  • Parameters

    • rest...this: any
    • ev: KeyboardEvent

    Returns Promise<void>

AppendButton

  • AppendButton(menu, ...menuitems): void
  • Parameters

    • menu: HTMLElement

      The menubar

    • rest...menuitems: readonly HTMLElement[]

      The to-be prepended menuitem

    Returns void

Create

  • Create(id, menuItems, options, htmlOptions): HTMLDivElement

  • Parameters

    • id: string

      The menu's ID

    • menuItems: readonly (string | Node | HTMLOptionsUnion)[]

      The menu's content. Any <button> element without a role (regardless of nesting) will be assigned the menuitem role and thus be elligble for menu-style navigation. Buttons that open a sub-menu must have the aria-haspopup: "menu" attribute set and must be able to do so via a click action.

    • optionaloptions: { direction: rtl | ltr; role: menu | menubar } = undefined
      • direction: rtl | ltr

        The direction of the menu. Should match the value of the CSS direction property if provided

      • role: menu | menubar

        The role of the menu/menubar

    • optionalhtmlOptions: Partial<Record<menu, Omit<HTMLOptions<any>, tag>>> = undefined

      Additional ElementCreate options to-be applied to the respective (child) element

    Returns HTMLDivElement

    • The menu

PrependItem

  • PrependItem(menu, ...menuitems): void
  • Parameters

    • menu: HTMLElement

      The menubar

    • rest...menuitems: readonly HTMLElement[]

      The to-be prepended menuitem

    Returns void