Skip to content

@fabwcie/free-drawing / utils/dom / arrowNavigation

Function: arrowNavigation() ​

arrowNavigation($container, getItems, orientation, onMove?): void

Defined in: packages/free-drawing/src/utils/dom.ts:98

Arrow keys move focus between items (last to first and back), Home / End to first / last item. Handled keys are not propagated, so drawer shortcuts (e.g. arrows moving selection) are not triggered.

Parameters ​

$container ​

HTMLElement

element listening to keydown of its items

getItems ​

() => HTMLElement[]

items in navigation order, read on each key (disabled buttons skipped)

orientation ​

"horizontal" | "vertical"

horizontal: left / right arrows, vertical: up / down arrows

onMove? ​

($item) => void

called with the newly focused item

Returns ​

void