Function: useKeyboardNavigation() — Kata docs
Kata docs

kata-framework


Function: useKeyboardNavigation()

function useKeyboardNavigation(choices, onSelect): object;

Defined in: packages/kata-react/src/a11y.ts:27

Hook that provides arrow key + Enter navigation for a list of choices. Returns the focused index and a keydown handler.

Parameters

choices

Choice[]

onSelect

(choiceId) => void

Returns

object

focusedIndex

focusedIndex: number;

onKeyDown

onKeyDown: (e) => void;

Parameters

e

KeyboardEvent

Returns

void