-
Notifications
You must be signed in to change notification settings - Fork 118
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
hotkeys in input #127
Comments
I'll investigate this and come back to you. |
Well since the hook is just a wrapper function and the solution according to your linked issue is to use |
I did this and it works on input/select/textarea elements import hotkeys, {HotkeysEvent} from 'hotkeys-js';
import {useCallback, useEffect} from "react";
type CallbackFn = (event: KeyboardEvent, handler: HotkeysEvent) => void;
export function useHotkeys(keys: string, callback: CallbackFn, deps: any[] = []) {
const memoisedCallback = useCallback(callback, deps);
useEffect(() => {
hotkeys.filter = () => {
return true;
}
hotkeys(keys, memoisedCallback);
return () => hotkeys.unbind(keys);
}, [memoisedCallback]);
} |
@gagandeepgill pls reference this comment #146 (comment) |
Any updates on this? This is such a nice Hook |
@Nolux Sorry for not having any updates on this. Because of health issues I was forced to lay down programming for a bit. I try to get this done next week. |
No worries mate. I solved it using the hook mentioned above |
Thanks for taking time out to update this. This hook is really helpful :) |
@Nolux This should already be possible. I'll update the docs on this. |
Is there a way to handle a hotkey press inside an text input?
relevant: jaywcjlove/hotkeys-js#85 (comment)
The text was updated successfully, but these errors were encountered: