react-use-hotkeys
react-use-hotkeys copied to clipboard
hotkeys using < or > not working
I need to create a hotkeys as "option+<" and "option+shift+<", but they are not working.
Hi @FranRioLorda. The combination 'option+<'
('Alt+<'
) results in the following event.key
value: ≤
. If you would like to create a modifier combo to achieve what you want, you can do 'Alt+,'
, which from a users perspective involves pressing option
/alt
and the <
key. You can get the event.key
value for a given keyboard press using this tool: https://www.toptal.com/developers/keycode.
Let me know if this helps, or if I've misunderstood 😄
Hi @reecelucas!. First of all, thank you very much by your ultra fast response and your time! I'm going to put more context, cause I think that was me who didn't explain very well! I've created a hotkey using useHotKeys with "option+<", an it does not work. I've tried your solution, with "Alt+<" and "≤" and "≥" to no avail. I have many other hotkeys in the app using your great hook without any problems at all!
Ah, I see, this is because the Alt
key changes the event.key
value, so using "Alt+,"
results in the ≤
event.key
, but the logic for modifier combinations doesn't handle this. It's a tricky one, but I'll look into a solution. In the meantime you might be able to use the escape hatch to provide a workaround this limitation for the time being.