
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
key-event-utils
Advanced tools
KeyboardEventUtils is a utility module for handling keyboard events in React applications. It provides helper functions to check for specific key presses, optionally with modifier keys (e.g., Ctrl, Alt, Shift, Meta) and by default strict check for the key.
Enter, Tab, Escape, arrow keys, and more.Ctrl, Alt, Shift, Meta/Cmd). npm i key-event-utils
import {KeyboardEventUtils} from 'key-event-utils';
Each key has a corresponding function to check if it was pressed. For example:
function handleKeyDown(event: React.KeyboardEvent) {
if (KeyboardEventUtils.isEnterKey(event)) {
console.log("Enter key pressed! No modifiers Pressed");
}
if (KeyboardEventUtils.isEnterKey(event,"*")) {
console.log("Enter key pressed!"); // Any modifiers is allowed
}
if (KeyboardEventUtils.isEscapeKey(event, "ctrl")) {
console.log("Escape key pressed with Ctrl!");
}
}
You can specify modifiers as a string; Case doesn’t matter ctrl, Ctrl or CTRL will work. Supported modifiers are:
ctrlaltshiftmeta or cmd, mentioning one modifier itself will work, no need for OS specific.Some methods can also used for strict check for modifiers
function handleKeyDown(event: React.KeyboardEvent) {
if ( ( event.key === "v" || event.key === "v" ) && KeyboardEventUtils.isCtrlKeyPressed(event)) {
console.log("Ctrl + V");
}
if ( ( event.key === "v" || event.key === "v" ) && KeyboardEventUtils.isCtrlKeyPressed(event,"ctrl + shift") ) {
console.log("Ctrl + V");
}
}
The following keys are supported and its corresponding methods:
Enter -isEnterKeyTab - isTabKeyEscape - isEscapeKeyBackspace - isBackspaceKeyDelete - isDeleteKeyArrowUp, ArrowDown, ArrowLeft, ArrowRight - isUpArrowKey ... got the pattern right?The following methods are used for strict checks for modifiers:
isShiftKeyisCtrlKeyisAltKeyisCmdKey or isMetaKeyFAQs
KeyBoard Key Event Utils
The npm package key-event-utils receives a total of 1 weekly downloads. As such, key-event-utils popularity was classified as not popular.
We found that key-event-utils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.