CngxMenuFocusStack
projects/common/interactive/menu/menu-focus-stack.ts
Import#
import { CngxMenuFocusStack } from '@cngx/common/interactive'
Description#
Submenu focus-stack model shared by CngxMenuTrigger and the
context-menu trigger core. Owns the active submenu chain, the
saved-focus slot restored after close, and the W3C APG
ArrowRight / ArrowLeft / Escape / activation routing.
Index#
Instance Properties#
Methods#
Drop the captured element without focusing it. For ownership handoffs where another opener now owns focus and a restore would yank it away. Optional so custom factory implementations stay assignable.
CngxMenuHostTop-of-stack menu host, or the root when the stack is empty.
handleActivation(menu: CngxMenuHost, event: KeyboardEvent)Enter/Space: open a submenu parent, else activate the leaf and close.
KeyboardEventhandleArrowLeft(menu: CngxMenuHost, event: KeyboardEvent)ArrowLeft: pop the current submenu level when one is open.
KeyboardEventhandleArrowRight(menu: CngxMenuHost, event: KeyboardEvent)ArrowRight: open the active item's submenu when the policy allows.
KeyboardEventhandleEscape(event: KeyboardEvent)Escape: pop the innermost submenu, or hide the popover at the root.
KeyboardEventClose every open submenu innermost-first and clear the stack WITHOUT hiding the root popover. Called on the trigger's close path so a stale submenu chain never survives a non-Escape dismissal (outside-click, blur, scroll): the root popover is already closing, and a reopened menu must start from the root, not a submenu that no longer exists.