+ key #968
Answered
by
florianbepunkt
florianbepunkt
asked this question in
Q&A
+ key
#968
-
Hi, thank you for this library. I would like to implement a zoom functionality into an app. How can we use the + key as part of a shortcut? // this works
useHotkeys("alt+-", (e: KeyboardEvent) => {
e.preventDefault();
alert("zoom out");
});
// this does not work
useHotkeys("alt++", (e: KeyboardEvent) => {
e.preventDefault();
alert("zoom in");
}); |
Beta Was this translation helpful? Give feedback.
Answered by
florianbepunkt
Mar 6, 2023
Replies: 2 comments
-
Figured it out useHotkeys("alt + ±", (e: KeyboardEvent) => {
e.preventDefault();
alert("zoom in");
});
useHotkeys("alt+-", (e: KeyboardEvent) => {
e.preventDefault();
alert("zoom out");
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
florianbepunkt
-
Actually, the correct way would be to set the export default function App() {
useHotkeys("shift-+", (e) => console.log(e), { combinationKey: "-" });
// ....
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Figured it out