OGE logoOGE

Menubar

A persistent bar of application commands with the full WAI-ARIA APG menubar keyboard contract: roving tabindex, Left/Right between items, Down/Enter into a submenu, Escape unwinding one level at a time, type-ahead. Submenus — nested ones included — run on the same oge-menu-list and Escape stack as every other menu in the suite.

Before reaching for it, note the APG's own caveat: a menu bar is rarely the right pattern for plain site navigation. A <nav> of links — optionally with the disclosure pattern for expandable groups — needs none of this keyboard machinery and serves link semantics better. role="menubar" is for application-style command menus: think editor File/Edit bars, not page headers. (Angular Material has no menubar at all — MatMenu is a button-triggered dropdown; the CDK's cdkMenuBar is the closest reference.)

APG menubar nested submenus roving tabindex hamburger

Getting started

One items tree; children at any depth open as nested submenus. itemClick reports the item, its key and the hierarchical index path. shortcut renders a right-aligned accelerator hint (announced via aria-keyshortcuts; the binding stays yours) and badge a counter pill. Try the keyboard: Left/Right, Down to open, ArrowRight on Share, Escape to unwind.

items itemClick path

Last click: —

Declarative items

Both APIs, one rule: declarative children render first, then the items input — the house merge order shared with the toolbar and the button group. Nesting <oge-menubar-item> builds the submenu tree.

oge-menubar-item children first

Open mode

openMode governs the top level only: click (default, the desktop convention) or hover after hoverDelay. Nested levels always open on hover and ArrowRight — DevExtreme's showFirstSubmenuMode/showSubmenuMode split collapsed into behavior. With a menu open, hovering siblings switches in either mode.

openMode hoverDelay

Vertical menubar

Same widget, same roles: aria-orientation="vertical" is announced, Up/Down traverse the bar and ArrowRight opens the submenu beside it — the axis swap the APG prescribes.

orientation aria-orientation

Adaptive hamburger

compactBelow measures the menubar's own container, never the window — a bar inside a split pane adapts to the room it actually has. Below the threshold the whole bar becomes one hamburger button opening the full tree as nested menus. Drag the range to squeeze it.

compactBelow container width hamburger

Cancelable events

The -ing pair carries the house mutable cancel flag. Closes the menubar itself initiates (escape, select, navigation, api) are interceptable; pointer closes owned by the overlay (outside) and Tab only report submenuClosed. Lock the menu and try to open or Escape it.

submenuOpening submenuClosing cancel

Configuration

Suite-wide defaults for openMode, hoverDelay, orientation and compactBelow, plus every user-facing string — the bar's accessible name and the hamburger label included — via provideOgeMenubarConfig().

provideOgeMenubarConfig messages