Function: keyAction()
keyAction(
key,k):KeyAction|null
Defined in: packages/sdvtables/src/html/controls.ts:193
Task 10 (A45, G19): the action a keydown means, or null when it means nothing here. Pure. j/k (and the down and
up arrows) move the cursor row in display order, and enter the grid at the cursor row when the key came from
outside the rows; h/l (left and right arrows) move the cursor column over the shown sortable columns, starting
from the cursor column, else the sorted one, else the first; s sorts that column; / goes to the search box;
Enter and Space toggle the selection of the row the key landed on. Moves stop at the edges: j/k stop at the
first and last row of the CURRENT page and never turn it (the pager does), h/l at the first and last sortable
column. A left/right key that lands on a link or button inside a row (focused set, onRow false) is that
control's: null.
Parameters
key
string
k
Returns
KeyAction | null
Example
import { keyAction } from "@sportsdataverse/sdvtables/html";
// `l` on the first row of a table sorted by wins: the cursor column moves right, to net_epa
keyAction("l", {
focused: 0,
onRow: true,
cursor: { row: 0, col: null },
sorted: "wins",
cols: ["team", "wins", "net_epa"],
order: [0, 1, 2],
hotkeys: true,
});