
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
react-focus-onkeydown
Advanced tools
React hook for getting focus of a component when a key is pressed anywhere in the page
React hook for getting focus of a component when a key is pressed anywhere in the page
You can see the simplest demo here: Live demo
$ npm install --save react-focus-onkeydown
Run examples:
cd examples
npm install
npm start
import React, { useRef } from 'react';
import useFocusOnKeyDown from 'react-focus-onkeydown';
const () => (
const ref = useRef(null);
useFocusOnKeyDown(ref);
// Typing any key will trigger a focus on the input below
<input ref={ref} />
)
Type: ref, required
ref to the target element
Type: boolean, default: true
Controls whether or not hook is active (i.e., whether or not a keydown will cause the element to focus)
See the LICENSE file for license rights and limitations (MIT).
FAQs
React hook for getting focus of a component when a key is pressed anywhere in the page
The npm package react-focus-onkeydown receives a total of 44 weekly downloads. As such, react-focus-onkeydown popularity was classified as not popular.
We found that react-focus-onkeydown demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.