Skip to main content
cngx-src documentation

CngxMenuDismissSource

Type Aliascommon/interactive/menu

projects/common/interactive/menu/dismiss-handler.ts

Description#

Identifier for the dismissal path that fired most recently.

  • outside-click - pointerdown outside both the popover and the trigger host.

  • scroll - window scroll while the menu is open.

  • blur - window blur (system notification, OS-native context menu overlaying the cngx menu).

  • pointer-cancel - document pointercancel originating OUTSIDE the popover and host (palm rejection from outside the menu, gesture cancelled by the browser). In-menu palm rejections do not dismiss.

  • escape - document keydown matching the Escape key while the popover is visible. Detected by the factory's capture-phase keydown listener so the source is recorded regardless of where DOM focus sits (trigger button, menu container, or elsewhere).

    Intent, not effect. The factory records 'escape' synchronously on the keystroke and does NOT call popover.hide(). Whether the menu actually closes is owned by CngxPopover.closeOnEscape: consumers who set [closeOnEscape]="false" keep their menu open even though lastSource reports 'escape'. The other sources (outside-click, scroll, blur, pointer-cancel) call popover.hide() themselves and so always coincide with an actual close - 'escape' is the one source where intent and effect can diverge.

Definition#

"outside-click" | "scroll" | "blur" | "pointer-cancel" | "escape"