Hotkey

Primitive #28

๐Ÿ” Problem it solves

Singleโ€‘key shortcuts (e.g., `?` for help, `h` for home) should not trigger when the user is typing in an input, textarea, or contenteditable. Manually checking the focused element is repetitive.

โœ… Solution

registerHotkey(key, callback) attaches a global listener that automatically ignores the event if focus is inside a form field. Returns a cleanup function.

๐Ÿงฉ Used by components

HelpDialog, QuickActions, SearchFocus, CommandPalette, SidebarShortcut

๐ŸŽฎ Interactive demo