Skip to content

isModifierKey

ts
function isModifierKey(key): boolean;

Defined in: parse.ts:272

Checks if a string is a recognized modifier token (including aliases).

For a KeyboardEvent, use isModifierKey(normalizeKeyName(event.key)): event.key can be missing on events that autofill and extensions send. DOM spellings like OS and Win are in the same alias table. AltGraph is not.

Parameters

key

Key | string & object

Key name or alias (e.g. from a hotkey string or event.key)

Returns

boolean

True if the string is a recognized modifier