Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix(useMagicKeys): doesn't trigger on releasing and pressing again the second key in a combination #4691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
Loading
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use nextTick instead of setTimeout
  • Loading branch information
hunterwilhelm committed Apr 4, 2025
commit e8cd2b40d1ecb5556819f79b3c32ed424927dbb6
6 changes: 3 additions & 3 deletions 6 packages/core/useMagicKeys/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ComputedRef, MaybeRefOrGetter } from 'vue'
import { noop } from '@vueuse/shared'
import { computed, reactive, shallowRef, toValue } from 'vue'
import { computed, nextTick, reactive, shallowRef, toValue } from 'vue'
import { defaultWindow } from '../_configurable'
import { useEventListener } from '../useEventListener'
import { DefaultMagicKeysAliasMap } from './aliasMap'
Expand Down Expand Up @@ -142,9 +142,9 @@ export function useMagicKeys(options: UseMagicKeysOptions<boolean> = {}): any {
// Solution: Trigger "keyup" event manually when "keydown" event is fired without "keyup"
if (key && e.getModifierState('Meta') && current.has(key)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

it this a meta key only problem? what about shift and ctrl?

Copy link
Author

Choose a reason for hiding this comment

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

updateRefs(e, false)
setTimeout(() => {
nextTick(() => {
updateRefs(e, true)
}, 0)
})
}
else {
updateRefs(e, true)
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.