Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
use-keyboard-shortcut
Advanced tools
A custom React hook for adding keyboard shortcuts to your application
A custom React hook that allows adding keyboard shortcuts to a React application.
import React from 'react'
import useKeyboardShortcut from 'use-keyboard-shortcut'
const App = () => {
useKeyboardShortcut(['Shift', 'H'], () => console.log('Shift + H has been pressed.'), { overrideSystem: false })
return (
<div>Hello World</div>
)
}
For another example on how to use this hook, please see the example project
useKeyboardShortcut(shortcutArray, callback, options)
Parameter | Type | Description |
---|---|---|
shortcutArray | Array | Array of KeyboardEvent.key strings. A full list of strings can be seen here |
callback | Function | Function that is called once the keys have been pressed. |
options | Object | Object containing some configuration options. See options section |
A list of possible options to put in the options object passed as the third parameters to the hook.
Option | Default | Description |
---|---|---|
overrideSystem | false | Overrides the default browser behavior for that specific keyboard shortcut. |
ignoreInputFields | true | Allows disabling and disabling the keyboard shortcuts when pressed inside of input fields. |
FAQs
A custom React hook for adding keyboard shortcuts to your application
We found that use-keyboard-shortcut demonstrated a not healthy version release cadence and project activity because the last version was released 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.