Skip to content
OGE logoOGE

Tooltip & Context Menu

Two directives turn the overlay engine into everyday UI: ogeTooltip attaches an accessible, viewport-aware tooltip to any element, and [ogeContextMenu] opens a fully keyboard-navigable menu at the pointer on right-click. Both render into the document body, so overflow or transformed ancestors never clip them.

ogeTooltip tooltipPlacement [ogeContextMenu] contextMenuItemClick

Tooltip basics

Bind a string to ogeTooltip on any element. The bubble shows after a short hover dwell — or instantly on keyboard focus — and hides on leave, blur or Escape. While visible the trigger's aria-describedby points at the bubble, so screen readers announce it; an empty string disables the tooltip entirely.

ogeTooltip aria-describedby Escape

Tooltip placement & delays

tooltipPlacement prefers a side (top, bottom, left, right — centered on the anchor) and flips automatically when the viewport runs out of room. Delays fall back to the global overlay config (provideOgeOverlayConfig) and can be tuned per trigger; tooltipDisabled suppresses the tooltip without removing the directive.

tooltipPlacement tooltipShowDelay tooltipDisabled

Tooltip templates

ogeTooltip also takes a template, with tooltipContext as its $implicit — formatting, icons, a second line — and stays a non-interactive tooltip (never put focusable controls in it; reach for a popover then). tooltipArrow draws a callout pointer, tooltipMaxWidth widens or narrows the bubble, and tooltipShowMode switches from hover-and-focus to focus, click (toggles) or manual — driven through #tip="ogeTooltip" → open() / close() / toggle().

TemplateRef tooltipContext tooltipArrow tooltipShowMode tooltipMaxWidth

Context menu

Bind an OgeMenuItem array to [ogeContextMenu] and right-click opens it at the pointer, replacing the browser menu. Shift+F10 (or the menu key) opens it anchored to the element for keyboard users. The menu takes focus with full arrow-key, Home/End and type-ahead support; Escape and outside clicks close it and focus returns to the target.

[ogeContextMenu] Shift+F10 OgeMenuItem
Right-click here (or focus + Shift+F10)

Context menu events

contextMenuItemClick delivers the activated item with its index and the originating DOM event — the same payload as OgeMenuList. contextMenuOpened and contextMenuClosed track visibility, and items support the full menu model: checkable entries, separators, disabled state, hints and destructive severity.

contextMenuItemClick opened / closed checked & danger
File: quarterly-report.xlsx
last action: —

Context menu delegation

One menu serves many rows: contextMenuTarget is a CSS selector matched with closest() inside the host, so a right-click (or Shift+F10 on a focused row) targets that row — anchor, focus return and all — and anywhere else keeps the browser menu. The cancelable contextMenuOpening event carries { target, items, cancel, event }: assign items to build the menu per row. #menu="ogeContextMenu" exposes open(x, y), open(event) and close().

contextMenuTarget contextMenuOpening open(x, y) exportAs
  • report.xlsx
  • budget.xlsx (locked)
  • notes.md
last action: —

Notes

  • Tooltips are transient: they never join the Escape stack, so an open tooltip cannot swallow the Escape meant for a drop-down or dialog underneath.
  • The tooltip bubble is hoverable (WCAG 1.4.13): the pointer can move from the trigger onto it and it stays open; Escape pressed anywhere dismisses it. It stays non-interactive — nothing in it takes focus; interactive content belongs in a popover.
  • Give context-menu targets tabindex="0" (when they are not natively focusable) so keyboard users can reach Shift+F10 and focus can be restored after closing.
  • Both directives read provideOgeOverlayConfig() for offsets, viewport padding and tooltip delays.