Skip to main content
cngx-src documentation

createW3CMenuStrategy

Functioncommon/interactive/menu

projects/common/interactive/menu/menu-nav-strategy.ts

Description#

Default W3C APG menu keyboard policy:

  • ArrowRight on a submenu parent that is currently closed → open-submenu. On an already-open submenu or a leaf item → noop (item-level navigation inside the open submenu is owned by the submenu's own active-descendant).
  • ArrowLeft when a submenu is open at the current level → close-submenu. Otherwise → move-to-parent (an enclosing menubar interprets that; a standalone menu trigger treats it as noop).

onArrowRight / onArrowLeft are the inline-forward / inline-back intents, not physical keys. The dispatch site resolves the physical arrow to its logical intent by writing direction before calling the strategy (resolveInlineArrowKey), so under rtl physical ArrowLeft routes to onArrowRight. Custom strategies therefore stay direction-naive and inherit correct RTL behaviour for free.

Signature#

createW3CMenuStrategy()

Returns#

CngxMenuNavStrategy