Skip to main content
cngx-src documentation

createTabKeyboardNav

Functioncommon/tabsv0.1.0

projects/common/tabs/keyboard/tab-keyboard-nav.ts

Description#

Level-2 helper implementing the WAI-ARIA APG tabs keyboard model for <cngx-tab-group> with automatic activation: an arrow press moves focus AND activates the target tab in one step, so focus and selection never diverge. Keeps the keyboard logic off the organism class (LOC guard) and out of a competing roving-tabindex state machine.

Pillar 1 (Ableitung statt Verwaltung): the tab stop is derived from the presenter's activeId, not managed as a second index. Pillar 2 (Kommunikation): activation routes through host.select(), which owns disabled-skip, loop, commit gating, and the live-region announcement - the keyboard layer adds only focus movement (a DOM concern the presenter, living in @cngx/common, must not own).

Navigation always originates from the active tab: under automatic activation the focused tab is always the active one, so the clamped active index is the correct origin.

Signature#

createTabKeyboardNav(opts: CngxTabKeyboardNavOptions)

Parameters#

Returns#

CngxTabKeyboardNav