CngxMenuDismissHandlerOptions
projects/common/interactive/menu/dismiss-handler.ts
Import#
import { CngxMenuDismissHandlerOptions } from '@cngx/common/interactive'
Description#
Options for createMenuDismissHandler.
Each boolean toggles its listener (pair) independently. When
dismissOnBlur is true, both window blur and document
pointercancel listeners install together - they represent the same
"context lost" semantic and consumers who want one rarely want the
other off.
Index#
Instance Properties#
Install window blur AND document pointercancel listeners.
Bundled together because both signal context loss. pointercancel
events whose target lies inside the popover or trigger host are
filtered out (in-menu palm rejection must not dismiss).
HTMLElementTrigger host element. Pointerdown / pointercancel events whose target lies inside this element are NOT treated as dismissal - interactions with the trigger itself should never close the menu it just opened.
Synchronous callback invoked from the DOM event handler whenever a
dismissal source fires. Runs AFTER popover.hide() so consumers
observing the source see the post-close state. Used by
createMenuTriggerDismissBinding to write a reactive
lastSource signal from outside any Angular effect() context.
CngxMenuDismissPopoverRefPopover whose .hide() runs when any dismissal source fires.
ReadonlySetSources whose listeners should NOT install even when their toggle
is true. Lets a consumer keep dismissOnBlur: true but skip the
bundled pointer-cancel listener (or vice versa) with a one-line
factory wrapper:
providers: [{
provide: CNGX_MENU_DISMISS_HANDLER_FACTORY,
useValue: (opts) => createMenuDismissHandler({
...opts,
skipSources: new Set(['pointer-cancel']),
}),
}]'escape' may be skipped too; the popover's global Escape listener
still owns the close path, so skipping only stops the source from
being recorded on lastSource.