formaat-design / reshaped

Community repository for storing examples, reporting issues and tracking roadmap
https://reshaped.so
120 stars 4 forks source link

[BUG] Hotkey combinations using ALT #320

Closed meisterdomi closed 2 months ago

meisterdomi commented 2 months ago

Describe the bug

Using a hotkey combination using alt+... isn't working in all cases. By relying on the code event property while ALT is pressed some keys like SHIFT won't work anymore because the code for it is either ShiftRight or ShiftLeft.

That being said, a combination of e.g. alt+shift+n works if

as in latter case ShiftLeft is being used internally

To Reproduce Create an isolated reproduction on the CodeSandox: https://codesandbox.io/p/sandbox/focused-mcnulty-llxfc9

Expected behavior

Key combinations including alt+shift should work independent from the pressed order.

Screenshots If applicable, add screenshots to help explain your problem.

Screenshot 2024-09-18 at 16 20 55

Environment (please complete the following information): OS: MacOs Browser Chrome(latest) Version [e.g. 22] 3.1.4

blvdmitry commented 2 months ago

Good point, it's getting caused by the part handling alt key combinations since in many cases it modifies e.key. It was only meant to happen for the letters and numbers but it was happening for other keys like shift too. I got the fix ready and releasing a patch, so it should only trigger for "shift" and not "shiftLeft"