AbsoluteJS

Hotkeys

@absolutejs/hotkeysv0.1.1betaFrontend & UX

Framework-agnostic keyboard shortcuts: chords, sequences, scopes and a self-describing binding registry.

#Installation

BASH
bun add @absolutejs/hotkeys

#Capabilities

Overview

Keyboard shortcuts that stay honest: chords, sequences, scopes, and a registry that can describe itself — so the shortcuts-help overlay is generated from the bindings that actually exist rather than hand-maintained beside them.

Core (no framework)

mod is Meta on Apple platforms and Control everywhere else, so one

binding string is correct on every machine.

Sequences (g i) fire only when typed in order within a second; a wrong

Show 3 more

key aborts rather than lingering.

Text entry is respected. Bindings don't fire while an input,

textarea or contenteditable has focus unless they pass allowInInput: true — typing "e" in a reply must never dismiss a thread.

Scopes

A scope is a stack. Push one when a modal or a focused list takes over, and its bindings win over the app-wide ones until it pops.

when: () => boolean gates a binding at press time for finer conditions.

Vue

Bindings unregister with the component's effect scope, so a closed modal can't leave a live shortcut behind.

Shortcuts help

Only described bindings appear: if it isn't worth naming, it isn't worth teaching.

Outcomes

What you can build

Overview

Keyboard shortcuts that stay honest: chords, sequences, scopes, and a registry that can describe itself — so the shortcuts-help overlay is generated from the bindings that actually exist rather than hand-maintained beside them.

Core (no framework)

mod is Meta on Apple platforms and Control everywhere else, so one

Scopes

A scope is a stack. Push one when a modal or a focused list takes over, and its bindings win over the app-wide ones until it pops.

Hardening checklist

Production guidance

Make every external boundary explicitPin the deployed @absolutejs/hotkeys version, replace example or memory-backed dependencies with durable implementations, bound external calls, protect credentials, and emit enough evidence to retry or recover safely.

Follow in order

Troubleshooting path

1
Trace from the first failed boundary
Reproduce the smallest canonical @absolutejs/hotkeys example, confirm the supported entry point and version in the API explorer, then inspect the first boundary that did not produce its documented result.

#@absolutejs/hotkeys quick start

Partial snippet

# @absolutejs/hotkeys

BASH
bun add @absolutejs/hotkeys

#Core (no framework)

Partial snippet

Working example for Core (no framework).

TS
import { hotkeys, listenForHotkeys } from "@absolutejs/hotkeys";

const stop = listenForHotkeys();

hotkeys.register("j", selectNext, { description: "Next", group: "Navigation" });
hotkeys.register("mod+k", openPalette, { description: "Command palette" });
hotkeys.register("g i", goToInbox, { description: "Go to inbox" });

#Scopes

Partial snippet

A scope is a stack. Push one when a modal or a focused list takes over, and its bindings win over the app-wide ones until it pops.

TS
hotkeys.register("escape", closeApp);
hotkeys.register("escape", closeModal, { scope: "modal" });

hotkeys.pushScope("modal"); // escape now closes the modal
hotkeys.popScope("modal");  // ...and the app-wide binding is back

#Public entry points

Supported entry points declared by this project’s package manifest. Internal dist paths are not part of the package contract.

Public package entry point declared in package.json.

@absolutejs/hotkeys@absolutejs/hotkeys/vue@absolutejs/hotkeys/package.json

#Package commands

Scripts declared by this project’s package manifest.

bun run buildrm -rf dist && bun build src/index.ts src/vue.ts --outdir dist --root ./src --target=browser --format=esm --splitting --external vue && tsc --emitDeclarationOnly --project tsconfig.json
bun run testbun test
bun run typechecktsc --noEmit

#API reference

Search the declarations exported by the current package type files. Expand a symbol to inspect its source-backed signature.

21 symbols
chordFromEventexportPermalink
TS
chordFromEvent
Exported from @absolutejs/hotkeys