Replies: 6 comments
-
When using Related Chromium issue: issues.chromium.org/issues/40880986 You can create an artificial keyup event by waiting a certain amount of time after the last keydown event. The only caveat is that different people will have different repeat rates in their operating systems. |
Beta Was this translation helpful? Give feedback.
-
@whiteyebrw I see, thank you for the quick reply and suggestions! |
Beta Was this translation helpful? Give feedback.
-
Looks like there’s nothing we can do about it :( |
Beta Was this translation helpful? Give feedback.
-
Hi, As far as I can see
https://w3c.github.io/uievents/tools/key-event-viewer.html ![]() |
Beta Was this translation helpful? Give feedback.
-
Hi @laygir, You have to hold meta later, like hold 'a' after releasing 'a' and you won't see the event 'keyup' for 'a'. |
Beta Was this translation helpful? Give feedback.
-
Hi @whiteyebrw Thank you for the detail! I see the issue now. I came here because I wanted to use I ended up doing the following, which works as I expected, for instance holding meta and shift and only releasing and pressing const handleSideBarToggleKeyPress = (event) => {
if (event.code === 'KeyS' && event.metaKey && event.shiftKey) {
event.preventDefault();
isSideBarOpen.value = !isSideBarOpen.value;
}
};
onMounted(() => {
document.addEventListener('keydown', handleSideBarToggleKeyPress);
});
onUnmounted(() => {
document.removeEventListener('keydown', handleSideBarToggleKeyPress);
}); (Sorry for hijacking the issue with my specific use case) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
When performing the following sequence:
The
current
variable isn't updated properly.I would expect to only see
Cmd
. Instead, it still showsCmd
+A
In the screenshot below, I am only holding
Cmd
.A
is not pressed anymore.Reproduction
https://vueuse.org/core/useMagicKeys/
System Info
Used Package Manager
pnpm
Validations
Beta Was this translation helpful? Give feedback.
All reactions