Skip to content

About

Keyboard chords, arrow-key grid focus and standard-mapping gamepad input for DOM apps, with no framework import.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

dom-input-nav

License: MIT npm TypeScript


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' | null

Quick start

bun add @rethunk/dom-input-nav

A worked example and the contracts: HUMANS.md.

Features

  • parseKeys, formatChord and matchChord turn key events into a stored chord string and match them against a table.
  • isTypingTarget tells a text field from a checkbox, so shortcuts stay quiet only while typing.
  • arrowFocus and nextIndex walk a grid or row of items with the arrow keys.
  • heldActions, firedActions and heldElsewhere turn standard-mapping gamepad state into actions with key repeat.
  • spatialNext picks the control nearest in a direction, for controller focus.
  • Button names the standard-mapping button indices; @rethunk/dom-input-nav/playwright installs and presses a faked pad in a Playwright test.

Documentation

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

License

MIT — see LICENSE. © 2026 Rethunk.Tech, LLC.

About

Keyboard chords, arrow-key grid focus and standard-mapping gamepad input for DOM apps, with no framework import.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages