-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
**Feature:** Hotkey hook #956
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny changeset to finish this
src/useHotkey/README.md
Outdated
const useRef = require("react").useRef | ||
|
||
const Component1 = () => { | ||
const scope = useRef(null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use containerNode
here.
src/useHotkey/useHotkey.test.tsx
Outdated
// Meta | ||
fireEvent(rendered, new KeyboardEvent("keydown", { key: "o", metaKey: true })) | ||
expect(callbackCtrl.mock.calls.length).toBe(1) | ||
expect(callbackShift.mock.calls.length).toBe(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To have been called with autocomplete
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mpotomin is the future
f2d2838
to
3bdb652
Compare
Summary
Adds a hook, that allows intercepting a hotkey combination in an HTML element and triggering a callback in reponse
Related issue
PAN-33
To be tested