Skip to content

ctrl + z is unstable (lib artefact fix)#4134

Closed
sergeyteleshev wants to merge 1 commit intodevelfrom
3815-ctrl-z-is-unstable
Closed

ctrl + z is unstable (lib artefact fix)#4134
sergeyteleshev wants to merge 1 commit intodevelfrom
3815-ctrl-z-is-unstable

Conversation

@sergeyteleshev
Copy link
Contributor

@sergeyteleshev sergeyteleshev commented Feb 12, 2026

closes #3815

The bug is on the lib side. The issue here is that it fires the event handler on almost every key press because it does not account for modifiers (Ctrl, Cmd, Alt, etc.).

What I've done here:

  1. fixed bug and created issue & PR for the library [BUG] modifiers (shift, ctrl, cmd, etc.) don't work for useKey:true flag JohannesKlauss/react-hotkeys-hook#1318
  2. Build the lib and these artefacts put them into our codebase
  3. Then, I implemented the fix for the task. Added useKey:true so it parses shortcuts not by the code but for the symbol itself. So, for example, the symbol "s" is the same on any type of keyboard (QWERTY, AZERTY, etc.).

As a third alternative solution, we can just wait for the lib to fix the issue. Then update the lib

@@ -0,0 +1,14 @@
import { ReactNode } from 'react';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert. Modifying a library’s internal code should be a last resort. We need to be absolutely certain the problem originates in the library. To confirm that, we should open an issue with a question, wait for the maintainer’s response, and then we can make a decision.

I’m not convinced the problem is on the library side, it seems they are aware of the layout differences and already support them.

https://react-hotkeys-hook.vercel.app/docs/documentation/useHotkeys/ignore-layouts

Copy link
Contributor Author

@sergeyteleshev sergeyteleshev Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not convinced the problem is on the library side

This is definitely a library side issue. All modifiers (ctrl, shift, cmd, etc.) DON'T WORK at all. So you are unavailable to do something like ctrl+shift+s or ctrl+S (as an alternative with useKey: true flag)

I'm not the only one who thinks like that:
JohannesKlauss/react-hotkeys-hook#1318
JohannesKlauss/react-hotkeys-hook#1316
JohannesKlauss/react-hotkeys-hook#1300

Moreover, there are recent changes in this area according to git blame. I've checked, and previously it worked before the refactor they did

@sergeyteleshev sergeyteleshev deleted the 3815-ctrl-z-is-unstable branch February 23, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ctrl + z is unstable

2 participants