Closed benwiley4000 closed 5 months ago
Using useKey
on a mod
combination doesn't really make sense. useKey
listens to the produced key and not the key code. In case of mod+z
and shift+mod+z
the produced key will just be z
. As explained int here, you want to omit useKey
in order to exactly listen to mod+z
Hey there sorry for the late reply. The problem is that if we don't use useKey, then mod+z actually detects mod+w on an AZERTY (French) keyboard. Which closes the window.. oops! I'm not using "useKey" for anything else, only this.
This behavior is desirable for implementing e.g. WASD nav where the key position is important, but indesirable for implementing shortcuts associated with specific letters e.g. mod+Z.
Ben
Le jeu. 25 avr. 2024, 10 h 45 a.m., Johannes Klauss < @.***> a écrit :
Closed #1168 https://github.com/JohannesKlauss/react-hotkeys-hook/issues/1168 as completed.
— Reply to this email directly, view it on GitHub https://github.com/JohannesKlauss/react-hotkeys-hook/issues/1168#event-12604422764, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADHOD3IQ5JOLSZJ2J5SG5UDY7C7EPAVCNFSM6AAAAABGJVJIUSVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJSGYYDINBSGI3TMNA . You are receiving this because you authored the thread.Message ID: <JohannesKlauss/react-hotkeys-hook/issue/1168/issue_event/12604422764@ github.com>
You can use preventDefault: true
to prevent the Window closing down. As said since mod plus a key doesn't produce its own key, useKey: true
won't be of much help
Describe the bug I'm using the "useKey" option on the v5 release, but when I do this, it's as if I also passed "ignoreModifiers: true". Setting "ignoreModifieres" explicitly to false doesn't fix the problem though.
To Reproduce Steps to reproduce the behavior: 1.
Please try and add a codesandbox or stackblitz to reproduce the bug: https://codesandbox.io/p/devbox/elegant-blackburn-nsmrq8?file=%2Fpackage.json%3A28%2C2
Expected behavior The hotkey hook should only fire for the described key combination
Desktop (please complete the following information):
Additional context I need this in order to support Ctrl/Cmd+Z on AZERTY keyboards, which place the Z in the position where "W" is on a QWERTY keyboard.