listview-navigator
Delegate arrow key down or up operation on list container. For a list, it will be a more friendly interaction if it could react to uparrow or downarrow
event. That's why this package exist. However, for this packages it has some constraints and requirement:
-
The length of list should be set on initial state.
-
List item should have fixed height.
usage
; thislistNavigator = target: thislistNode max: thisdataSourcelength itemHeight: thisitemHeight;
On press uparrow or downarrow, it will emit change event. The arguments on callback function will nextIndex
and index
;
thislistNavigator
On press Enter, it will emit commit event. The arguments on callback function will nextIndex
and index
;
thislistNavigator
API
ListViewNavigator
Arguments
target
(HTMLElement): The list container which will delegated to.itemHeight
(Number): The list item height.max
(Number): The count of list items