CngxChipStripRovingController
projects/common/interactive/reorder/chip-strip-roving.ts
Import#
import { CngxChipStripRovingController } from '@cngx/common/interactive'
Description#
Controller produced by createChipStripRoving. Exposes an
activeIndex signal the consumer binds into
[attr.tabindex]="i === roving.activeIndex() ? 0 : -1", plus a
keyboard handler and imperative focus helpers.
Index#
Properties
Instance Properties#
SignalCurrent roving position. Clamped to [0, count - 1]; resets to
0 when count drops to 0.
Methods#
focusAt(index: number)Imperatively set the active index and focus the corresponding chip. Used by consumers to restore focus after a reorder settles on a new position.
handleKeydown(event: KeyboardEvent)Keyboard handler for the chip-strip container. Handles plain
ArrowLeft / ArrowRight / ArrowUp / ArrowDown / Home /
End - moves activeIndex and focuses the chip at the new
position. Events carrying any of Ctrl / Alt / Meta are
ignored (modifier-gated keys belong to the paired
CngxReorder directive).
KeyboardEventmarkFocused(index: number)Announce that a chip at index received focus - typically wired
on the chip wrapper's (focus). Idempotent; keeps the active
index in sync with whatever the user's focus sequence did (mouse
click, Tab into the strip, etc.).