Rokkit 1.0.3

The navigator Svelte action connects a controller to a container element. It intercepts keyboard events, routes them through the controller, and syncs DOM focus and ARIA state in response.

Usage

<ul use:navigator={{ controller, onselect }}>

Options

OptionTypeDescription
controllerListController | NestedControllerThe state machine to bind
onselect(value) => voidCalled when an item is selected
onchange(value) => voidCalled on any navigation change

How it works

The navigator reads data-path attributes on child elements to identify items. Set data-path on each item element and the navigator handles keyboard routing, type-ahead search, and ARIA attribute updates automatically.

Clicks on data-path elements are intercepted by the navigator — do not add separate onclick handlers on those elements, as this causes double-handling.

Related