KeyboardEvent.isNonCharacterKey

Returns true if the key represents one of the range named entries in the Key enum. This does not necessarily mean it IS one of the named entries, just that it is in the range. Checking more precisely would require a loop in here and you are better off doing that in your own switch statement, with a do-nothing default.

Remember that users can create synthetic input of any character value.

struct KeyboardEvent
bool
isNonCharacterKey
()

Meta

History

While this function was present before, it was undocumented until December 4, 2020.