Skip to main content
cngx-src documentation

resolveInlineArrowKey

Functioncore/bidiv0.1.0

projects/core/bidi/inline-nav.ts

Description#

Resolve a physical arrow key into its logical inline counterpart, honouring the writing direction. Under rtl the physical ArrowLeft and ArrowRight swap, so a dispatch site can route a physical key to the handler that owns its logical intent (inline-forward / inline-back). Any other key - vertical arrows, Home, End, letters - is returned verbatim.

Tier-2 semantic strategies (menu submenu open/close, tree expand/collapse) resolve the key here at the dispatch site, so the strategy contract stays logical and custom strategy overrides get RTL for free.

Signature#

resolveInlineArrowKey(key: string, direction: CngxDirection)

Parameters#

@paramkeystring

The physical KeyboardEvent.key value.

@paramdirectionCngxDirection

The document writing direction from injectDirection.

Returns#

string

The logical key: swapped horizontal arrow under rtl, else key unchanged.