resolveInlineStep
projects/core/bidi/inline-nav.ts
Description#
Resolve a horizontal arrow key into an inline-axis index step, honouring
the writing direction. Under ltr, ArrowRight advances (+1) and
ArrowLeft retreats (-1); under rtl the two swap, because the first
item in reading order sits on the right. Any non-horizontal key (including
ArrowUp / ArrowDown / Home / End) returns null - the block axis
is the caller's concern and never direction-aware.
This is the mechanical kernel every direction-aware keyboard strategy shares (roving, tabs, stepper strip, slider, reorder); it is a pure function, not a DI chokepoint - each strategy injects its own direction and calls this.
Signature#
resolveInlineStep(key: string, direction: CngxDirection)Parameters#
The KeyboardEvent.key value.
The document writing direction from injectDirection.
Returns#
"1" | unknown | null 1 for inline-forward, -1 for inline-back, null for any other key.