Keyboard chords, arrow-key grid focus and standard-mapping gamepad input for DOM apps, with no framework import. Package @rethunk/dom-input-nav. First consumer: Mortar.
Every function takes plain objects, so a framework's event or a native one fits. Chords are stored as
short strings such as Ctrl+Shift+F, so an app can let people rebind them. Cmd and Meta read as Ctrl, so Ctrl+K also fires on Cmd+K and no chord tells the two apart.
matchChord(event, { palette: 'Ctrl+K', play: 'Ctrl+P' }) // 'palette' | 'play' | nullbun add @rethunk/dom-input-navA worked example and the contracts: HUMANS.md.
parseKeys,formatChordandmatchChordturn key events into a stored chord string and match them against a table.isTypingTargettells a text field from a checkbox, so shortcuts stay quiet only while typing.arrowFocusandnextIndexwalk a grid or row of items with the arrow keys.heldActions,firedActionsandheldElsewhereturn standard-mapping gamepad state into actions with key repeat.spatialNextpicks the control nearest in a direction, for controller focus.Buttonnames the standard-mapping button indices;@rethunk/dom-input-nav/playwrightinstalls and presses a faked pad in a Playwright test.
| Doc | Audience |
|---|---|
| HUMANS.md | Running and using the package |
| AGENTS.md | Internals, invariants, and why |
| CONTRIBUTING.md | Process — commits, tests, docs |
| SECURITY.md | Vulnerability disclosure |
| CHANGELOG.md | Release notes |
MIT — see LICENSE. © 2026 Rethunk.Tech, LLC.