Docs
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
Hotkeys API Reference
App Hotkeys API Reference
Key hold & held keys API Reference
Hotkey Recorder API Reference
Normalization & format API Reference
Key hold & held keys API Reference

matchesHeldModifiers

ts
function matchesHeldModifiers(
   hotkey, 
   heldKeys, 
   options?): boolean;
function matchesHeldModifiers(
   hotkey, 
   heldKeys, 
   options?): boolean;

Defined in: hint.ts:24

Returns whether held modifiers should reveal a shortcut hint. By default, any nonempty subset of the binding's modifiers qualifies; an unrelated modifier hides the hint. exact requires every binding modifier. Nonmodifier keys are ignored. This does not check registration or focus. A sequence reveals its hint from its first step.

Parameters

hotkey

RegisterableHotkey

heldKeys

readonly string[]

options?

HeldModifierOptions = {}

Returns

boolean

Example

ts
matchesHeldModifiers('Alt+Shift+[KeyK]', ['Alt']) // true
matchesHeldModifiers('Alt+Shift+[KeyK]', ['Alt', 'Control']) // false
matchesHeldModifiers('Alt+Shift+[KeyK]', ['Alt']) // true
matchesHeldModifiers('Alt+Shift+[KeyK]', ['Alt', 'Control']) // false