
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
keyshorts helps you add keyboard shortcuts to your website quickly and easily!!!
keyshorts helps you add keyboard shortcuts to your website quickly and easily!!!
Install dependence.
npm i keyshorts
Require keyshorts and register your first keyshort.
import 'keyshorts'
// register shortcuts
const unregister = document.querySelector('.div').registerKeyshort(['Shift', 'f'], () => { dosomething() })
// unregister shortcuts
unregister()
// or
import { register } from 'keyshorts'
// register shortcuts
const unregister = register(document.querySelector('.div'), ['Shift', 'f'], () => { dosomething() })
// unregister shortcuts
unregister()
Load dependence.
<script src="https://url/to/keyshorts.umd.js"></script>
And then register your first keyshort.
// register shortcuts
const unregister = document.querySelector('.div').registerKeyshort(['Shift', 'f'], () => { dosomething() })
// unregister shortcuts
unregister()
register a shortcuts to a html element.
Html element that you want register shortcuts to.
An array composed of keys (key of keyboard words), you can get all keys at MDN. Pay attention that, letter keys that in same letter but different cases (Upper and lower case) are different shortcuts when caseSensitive, for example: ['Shift', 'f'] and ['Shift', 'F'] are different when caseSensitive is true, they becomes same when caseSensitive is false. (more info about caseSensitive is aftertext).
It can be a single function to handle the event that shortcuts was hit.
Or it can be a Object to fully configure behaviors. It is composed these prop blow.
() => falsefalsefalse. (more info about repeat at MDN)Returns is a method to unregister shortcut.
To register shortcuts in an elegant way, we add a method to the prototype of HTMLElement, you can call it directory in HTMLElement instance like: document.querySelector('.div').registerKeyshort(...).
Params and returns can refer to register method.
Only shortcuts will hit in the element that shortcuts registered at is focusing. When one shortcuts was hit, other same shortcuts will be ignored. You can ignore one shortcuts by manual to make hitting event propagate to other shortcuts handlers.
Register shortcuts to document.body.
Make sure the element is focusing, you can call focus() method in manual, and make it uneffective by calling blur().
FAQs
keyshorts helps you add keyboard shortcuts to your website quickly and easily!!!
We found that keyshorts 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
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.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.