mantine icon indicating copy to clipboard operation
mantine copied to clipboard

useHotkeys incorrect calls with ctrl+z ctrl+y

Open strblr opened this issue 1 year ago • 1 comments

Dependencies check up

  • [X] I have verified that I use latest version of all @mantine/* packages

What version of @mantine/* packages do you have in package.json?

7.10.2

What package has an issue?

@mantine/hooks

What framework do you use?

Vite

In which browsers you can reproduce the issue?

Chrome

Describe the bug

In the codesandbox demo, you can see in the console that if you hit ctrl+z or ctrl+y, the callbacks for both handlers are called at the same time, each time. ctrl+s works correctly.

import "@mantine/core/styles.css";
import { MantineProvider } from "@mantine/core";
import { useHotkeys } from "@mantine/hooks";

export default function App() {
  useHotkeys([
    ["ctrl+s", () => console.log("S")],
    ["ctrl+z", () => console.log("Z")],
    ["ctrl+y", () => console.log("Y")],
  ]);
  return <MantineProvider>App</MantineProvider>;
}

If possible, include a link to a codesandbox with a minimal reproduction

https://codesandbox.io/p/sandbox/mantine-react-template-q4dd5d?file=%2Fsrc%2FApp.tsx%3A4%2C32

Possible fix

No response

Self-service

  • [ ] I would be willing to implement a fix for this issue

strblr avatar Jun 14 '24 01:06 strblr

The sandbox that you've sent is empty

rtivital avatar Jun 14 '24 03:06 rtivital

You are welcome to reopen the issue if you can provide a minimal reproduction

rtivital avatar Jul 12 '24 15:07 rtivital